CreateObject() returns Model Hash

1. Client (production/canary) and FXServer version
Client: Production
FXServer: Linux 3352

2. What you expected to happen
Expecting CreateObject() on the server to return the Object ID handle

3. What actually happens
CreateObject() returns the model hash that was given to it

4. Category of Bug
OneSync Infinity - Server

5. Reproducible steps, preferably with example script(s)

RegisterCommand('testobject', function(ply,a,r)
  local pos = vector3(-447.72,6350.47,12.63)
  if ply ~= 0 then pos = GetEntityCoords(GetPlayerPed(ply)) end
  local mdl = GetHashKey("prop_waterwheela")
  local obj = CreateObject(mdl, pos, true, true, false)
  if DoesEntityExist(obj) then print("^1Object Exists.^7")
  else print("^1Object does NOT exist.^7")
  end
  print("Player:   ", ply);print("Position: ", pos)
  print("Model:    ", mdl);print("Object:   ", obj)
  Citizen.Wait(12000)
  DeleteEntity(obj)
end)

Result from the console typed from within game:
image
Result from the console when typed in the terminal:
image

According to the citizenfx/five repo, CreateObject is supposed to be a OneSync native. I’m fairly confident it’s not user error, since CreateObject returns zero if it fails, not the model hash that was given to it. But, I’ve been wrong before. Happy to help where I can. Appreciate all you guys do.

Note: The object doesn’t appear in game.

CreateObjectNoOffset() works perfectly. I will use that, but that confirms to me that CreateObject() is either not working or I’m really not using it properly.

Disregard. It now works. For no apparent reason, it started returning zero. After that happened, I added a small: while not DoesEntityExist(obj) do Wait(100) end loop, which came back valid and working just fine. I have no other way to explain it other than “it just started working”. Left to go wrap Santa presents for the kids, came back, and it started returning zero instead of the model hash. A short while loop later and everything’s good.

Update:
For anyone else who stumbles upon this and keeps getting zero for their objects, you can’t spawn objects/vehicles/etc server side when there are no players on the server, which is why mine was always returning zero. Basically you can’t spawn objects on the server and then just have them “be there” when players join.

As for why it was returning the model hash, I have no clue. It isn’t doing it anymore and hasn’t since the original post.