GetEntityHeading and GetEntityRotation both return 0 for prop_bench_01a entities

I’ve called GetClosestObjectOfType to get the closest prop_bench_01a entities, however when I try calling any of the functions in the title, it returns 0 no matter what.

bild

bild

I tested it with this code:

local coords = GetEntityCoords(PlayerPedId())
local bench = GetClosestObjectOfType(coords.x, coords.y, coords.z, 50.0, `prop_bench_01a`, true, false, false)
print(bench, GetEntityHeading(bench), GetEntityRotation(bench))

It returned this:
Untitled

Are you sure that the entity exists? What does object return if you print it? Maybe you need to increase the radius distance?

yeah, I simply must have been too tired when I tried fixing it, didn’t realize that I put it into a table and then sent that to the client. solved it by simply adding another GetClosestObjectOfType call on the clientside, fixed it flawlessly.

thanks nevertheless!

1 Like