THE ORB
Starting the studio

attempt to compare

A script tried to compare two things that cannot be compared, usually a number against something that is missing or is text.

groupsThat feature stops workingcodeNeeds a developer

Do this first

If it happened after a command, the values typed into that command are the likely cause.

bug_reportPaste your whole console instead

What it means

<, >, <= or >= was used between values Lua cannot order: attempt to compare nil with number, attempt to compare string with number, attempt to compare two table values.

== never produces this. Only the four ordering operators do, which narrows the search on the reported line immediately.

What causes it

Ordered by how often it is the answer.

  1. 1

    A nil on one side

    if playerMoney > price where the lookup returned nothing. Same underlying problem as an index-nil, one line later.

  2. 2

    A number that arrived as a string

    Config values written as "100", JSON payloads, and command arguments. FiveM command arguments are ALWAYS strings, including in /givemoney 1 5000.

  3. 3

    Comparing a vector to a number

    #(a - b) > 5.0 is correct. (a - b) > 5.0 compares vectors.

  4. 4

    A database column read straight through

    oxmysql returns what MySQL gives it, and DECIMAL columns can arrive as strings.

How to tell which one is yours

print(type(left), type(right))

The message already names the two types, so you are mostly confirming which variable holds which.

Where to look

The named line. If the value came from a command, look at the argument parsing; if from the database, look at the column type.

How to fix it

Convert once, at the boundary:

RegisterCommand('givemoney', function(source, args)
    local target = tonumber(args[1])
    local amount = tonumber(args[2])
    if not target or not amount or amount <= 0 then return end
    -- safe from here
end)

For distance, use the length operator:

if #(GetEntityCoords(ped) - target) > 5.0 then return end

Still stuck on your own code?

This page is what this error usually means. Paste your console into Server Fixer and it will rank everything in it and tell you what to do first, and if you would rather not touch it, ORBIE can repair the script and hand the resource back ready to drop in.

bug_reportOpen Server Fixer

Errors that travel with this one