Hi, I’m trying to spawn a vehicle but every time the car is spawning under the map.
This is how I writed the code:
local x, y, z = GetEntityCoords(source)
Vehicle = CreateVehicle(model, x, y, z + 5, 0.0, true, false)
The error is at Z value, why when I put + 5 it’s not working?
Try to add float instead of int. ‘5.0’ instead of ‘5’
Can you paste the error that you get?
SCRIPT ERROR: @rcn_freeroam/fr_client.lua:15: attempt to perform arithmetic on a nil value (local ‘z’)
OK, then try to use it like this:
local pos = GetEntityCoords(source)
Vehicle = CreateVehicle(model, pos.x, pos.y, pos.z + 5, 0.0, true, false)
Also in what event do you call these functions?
I’m calling these functions in a command client-side. Anyway figured it out and now the car is not spawning under the map anymore.
Thank you anyway!