Skip to content

SetPlayerPos

Moves the player’s game to a point - a teleport.

The client puts the player there on the next frame and the server’s record follows; reports from before the move are dropped, so honest clients never trip the speed check. z below 0 puts the player on the terrain at x, y. A mounted player is moved with the horse. Without yaw the player keeps their heading.

SetPlayerPos(pid, x, y, z [, yaw])
Parameter Type
pid number the player
x number metres
y number metres
z number metres; below 0 = on the terrain
yaw number degrees to face (optional)

boolean - false when not connected

-- /goto <name>: next to another player, facing the same way
local tx, ty, tz = GetPlayerPos(target)
SetPlayerPos(pid, tx + 1.5, ty, tz, GetPlayerYaw(target))

GetPlayerPos · SpawnPlayer · SetEntityPos · the Players group of the index