Home / Player

p:teleport()

p:teleport(x, y, z [, yaw [, pitch]])

Teleports an online player to the specified coordinates.

Parameters

NameTypeDescription
x, y, znumberWorld coordinates.
yawnumber, optionalRotation (yaw).
pitchnumber, optionalRotation (pitch).

Returns

Nothing.

Example

command('spawn', function(sender)
  if not sender.isPlayer then return true end

  local sx, sy, sz = world.spawn()
  sender:teleport(sx, sy, sz)
  sender:send(color.green .. "Teleported to spawn!")
  return true
end)

Notes

If the player is offline, this method does nothing.