THE ORB
Starting the studio

attempt to index a number / boolean / string value

A script got back a different kind of answer than it expected, often reading a database result the wrong way.

groupsThat feature stops workingcodeNeeds a developer

Do this first

This one needs a look at the code — it is a mistake in the script, not in your setup.

bug_reportPaste your whole console instead

What it means

. or [] was used on a value that exists but is not a table. This is different from indexing nil: something IS there, it is just the wrong type. That usually means an API returned a different shape than the code expected.

What causes it

Ordered by how often it is the answer.

  1. 1

    A native returned a handle, not a table

    local ped = GetPlayerPed(-1) then ped.x. The handle is a number.

  2. 2

    A function returned a boolean success flag

    Many helpers return success, data. Taking only the first value and indexing it gives exactly this.

  3. 3

    A query result read one level too deep

    oxmysql query returns an ARRAY of rows. result.identifier is indexing the array; result[1].identifier is the row.

  4. 4

    A config value that is a number where a table was expected

    Config.Jobs.police where Config.Jobs was written as a count instead of a table.

  5. 5

    String methods called on the wrong side

    ('x'):upper() is fine; x:upper() when x is a number is not.

How to tell which one is yours

print(type(thing), json.encode(thing))

The type in the message already tells you what it is; the value tells you where it came from.

Where to look

The line, and the call that produced the value one or two lines above it.

How to fix it

-- oxmysql returns rows, not a row
local rows = MySQL.query.await('SELECT * FROM users WHERE identifier = ?', { id })
local user = rows and rows[1]
if not user then return end

-- natives return handles
local ped = PlayerPedId()
local coords = GetEntityCoords(ped)   -- THIS is a vector

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