THE ORB
Starting the studio

GetPlayer(source) returned nil on the server

The server looked for a player and did not find one — usually they disconnected mid-action.

groupsOccasional failed actioncodeNeeds a developer

Do this first

Occasional ones are normal. Constant ones mean the script is not checking the player is still there.

bug_reportPaste your whole console instead

What it means

A server handler asked the framework for a player object and got nothing back. Every field access after that fails.

What causes it

Ordered by how often it is the answer.

  1. 1

    The player disconnected mid-operation

    Between the event firing and the handler running, they left. Common with any delayed or awaited operation.

  2. 2

    The source is wrong

    Inside a callback or a nested closure, source is not what you think. It must be captured at the top of the handler:

    local src = source
  3. 3

    The player is connected but not loaded

    During playerConnecting, and for a moment after joining, there is no player object yet — the character has not been selected.

  4. 4

    The source came from the client

    A client that sends its own id can send anyone's. This is a security hole as well as a nil.

  5. 5

    Wrong lookup function

    GetPlayerFromId (server id) vs GetPlayerFromIdentifier (license), used interchangeably by mistake.

How to tell which one is yours

local src = source
print('src', src, GetPlayerName(src))

If GetPlayerName is nil too, they are gone or never fully joined. If the name resolves but the framework object does not, they are connected but not loaded.

Where to look

The top of the event handler, and every place source is read after an await.

How to fix it

RegisterNetEvent('shop:buy', function(item, count)
    local src = source                       -- capture first, always
    local xPlayer = ESX.GetPlayerFromId(src)
    if not xPlayer then return end           -- they left, or never loaded
    -- never trust a client-supplied id: src is authoritative
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