Entity creation returned 0 or failed
Something tried to spawn a vehicle, person or object and it did not appear.
Do this first
Check the vehicle or model it wants is actually installed and its script is running.
What it means
A spawn native returned 0 instead of a handle. Nothing errored at that moment; the failure surfaces later as a bad argument or an index-nil when the handle is used.
What causes it
Ordered by how often it is the answer.
- 1
The model was never loaded
RequestModelis asynchronous. Spawning beforeHasModelLoadedreturns true gives 0 every time. - 2
The model does not exist
A custom vehicle or ped whose stream files are missing, misnamed, or in a resource that is not started. The hash is valid, the asset is not there.
- 3
The entity pool is full
See the entity limit error. At the ceiling, every creation returns 0.
- 4
Created on the server without OneSync
Server-side
CreateVehiclerequires OneSync. Without it the native is not available in that form. - 5
Created too far from any player
Server-side creation at coordinates nobody is near can fail to instantiate until someone is in range.
How to tell which one is yours
print(IsModelInCdimage(model), IsModelValid(model), HasModelLoaded(model))
false on the first two means the model does not exist on this server. True on both but false on the third means it is a loading race.
Where to look
The spawn call and the lines directly above it.
How to fix it
local function spawnVehicle(model, coords, heading)
local hash = type(model) == 'string' and GetHashKey(model) or model
if not IsModelInCdimage(hash) or not IsModelValid(hash) then return nil end
RequestModel(hash)
local deadline = GetGameTimer() + 5000
while not HasModelLoaded(hash) and GetGameTimer() < deadline do Wait(0) end
if not HasModelLoaded(hash) then return nil end
local veh = CreateVehicle(hash, coords.x, coords.y, coords.z, heading, true, false)
SetModelAsNoLongerNeeded(hash)
if not DoesEntityExist(veh) then return nil end
return veh
endStill 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