Home / Player

p:pos() / blockPos() / look()

p:pos() p:blockPos() p:look()

Reads the player's position or view rotation.

Parameters

None.

Returns

pos() returns world coordinates x, y, z. blockPos() returns the corresponding block coordinates. look() returns yaw, pitch.

Example

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

  local x, y, z = sender:blockPos()
  local yaw, pitch = sender:look()
  sender:send("Block position: " .. x .. ", " .. y .. ", " .. z)
  return true
end)