Skip to main content

Teleport

ESX.Game.Teleport(entity, coords, cb)

This function teleports an entity.

!!! warning This is an async function because it awaits collision to be loaded, there is an example below on how to properly utilize it.

Arguments

ArgumentData TypeOptionalDefault ValueExplanation
entitystringNo-The entity to teleport
coordstable&vector3No-The coords to be teleported to. Supports both vector3 and table types. If using a table type you can also specify heading to set the entity heading upon teleportation
cbfunctionYes-The returned function when the entity has been teleported

Example

local playerPed = PlayerPedId()

ESX.Game.Teleport(playerPed, {x = 120.0, y = -200.0, z = 30.0, heading = 100.0}, function()
print('this code is async!')
end)

print('this code is sync!')