TeleportPlayer
teleportPlayer
Teleports a connected player to an authoritative world position.
Syntax
bool teleportPlayer(int playerId, number x, number y, number z [, number yaw = 0])
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
playerId |
int |
yes | The connected player identifier. |
x |
number |
yes | World X coordinate in metres. |
y |
number |
yes | World Y coordinate in metres. |
z |
number |
yes | World Z coordinate in metres. |
yaw |
number |
no | Optional actor yaw in degrees; defaults to 0. |
Returns
Returns true when the teleport is accepted and queued; otherwise returns false.
Examples
Teleport a player to an RP spawn point:
teleportPlayer(playerId, 125.5, -48.0, 3.25, 180)
Notes
- Available only in server-side resource scripts.
- This is the explicit teleport alias of
setPlayerPositionand emitsonPlayerTeleport. - Coordinates use metres and yaw uses degrees.