THE ORB
Starting the studio

NetworkGetEntityFromNetworkId returned 0

A player's game was told about something before it had actually arrived on their screen.

groupsOccasional glitchescodeNeeds a developer

Do this first

Occasional ones are normal. Constant ones mean the script is not waiting properly.

bug_reportPaste your whole console instead

What it means

A network id was turned into a local entity handle and there is no such entity on this client yet. The native returns 0 rather than erroring, so the failure surfaces later as a bad argument or an index-nil.

This is usually a RACE, not a bug in the id: the server created the entity and this client has not received it yet.

What causes it

Ordered by how often it is the answer.

  1. 1

    The client was told before the entity synced

    The server creates a vehicle and immediately triggers a client event with the net id. The event arrives before the entity does.

  2. 2

    The entity is out of scope

    OneSync only syncs entities near the player. A net id for something across the map resolves to nothing on that client.

  3. 3

    It is in a different routing bucket

    Same as out of scope, deliberately.

  4. 4

    The entity was deleted between send and receive

    A vehicle removed while the message was in flight.

  5. 5

    The id is stale

    Net ids are reused. An id held from minutes ago may now mean something else, or nothing.

How to tell which one is yours

print(NetworkDoesNetworkIdExist(netId), NetworkDoesEntityExistWithNetworkId(netId))

Both false with the player standing next to it means a real problem; both false from across the map is just scope.

Where to look

Where the net id is received, and whether anything waits for the entity.

How to fix it

Wait for it, with a deadline — never an unbounded loop:

local function entityFromNet(netId, timeoutMs)
    local deadline = GetGameTimer() + (timeoutMs or 5000)
    while not NetworkDoesEntityExistWithNetworkId(netId) do
        if GetGameTimer() > deadline then return nil end
        Wait(0)
    end
    return NetToEnt(netId)
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