Teleport Library Lua Environment

TP (Teleport) Library Documentation

The tp library provides functions for teleporting and position management.


Position

tp.get_position()

Returns the local player's current position.

  • Returns: table with fields:

    • x [float] - X coordinate

    • y [float] - Y coordinate

    • z [float] - Z coordinate

    • valid [bool] - Whether position is valid

local pos = tp.get_position()
if pos.valid then
    print("Position: " .. pos.x .. ", " .. pos.y .. ", " .. pos.z)
end

tp.get_player_position(player_addr)

Returns a player's current position.

  • Parameters: player_addr [uint64] - Player address

  • Returns: table with fields:

    • x [float] - X coordinate

    • y [float] - Y coordinate

    • z [float] - Z coordinate

    • valid [bool] - Whether position is valid


Teleportation

tp.to_position(x, y, z)

Teleports the local player to coordinates.

  • Parameters:

    • x [float] - X coordinate

    • y [float] - Y coordinate

    • z [float] - Z coordinate

  • Returns: bool - Success

tp.to_vector(position)

Teleports the local player to a vector3 position.

  • Parameters: position [vector3] - Target position

  • Returns: bool - Success

tp.to_player(player_addr, offset_x?, offset_y?, offset_z?)

Teleports to another player's position.

  • Parameters:

    • player_addr [uint64] - Target player address

    • offset_x [optional float] - X offset (default: 0)

    • offset_y [optional float] - Y offset (default: 0)

    • offset_z [optional float] - Z offset (default: 0)

  • Returns: bool - Success

tp.to_closest(team_check?, offset_x?, offset_y?, offset_z?)

Teleports to the closest player.

  • Parameters:

    • team_check [optional bool] - Skip teammates (default: false)

    • offset_x [optional float] - X offset (default: 0)

    • offset_y [optional float] - Y offset (default: 0)

    • offset_z [optional float] - Z offset (default: 0)

  • Returns: bool - Success

tp.offset(x, y, z)

Moves the local player by a relative offset.

  • Parameters:

    • x [float] - X offset

    • y [float] - Y offset

    • z [float] - Z offset

  • Returns: bool - Success

tp.behind_player(player_addr, distance?)

Teleports behind a player.

  • Parameters:

    • player_addr [uint64] - Target player address

    • distance [optional float] - Distance behind (default: 5)

  • Returns: bool - Success


Distance

tp.get_distance(player_addr)

Returns the distance to a player in studs.

  • Parameters: player_addr [uint64] - Player address

  • Returns: float - Distance in studs (-1 if invalid)

tp.get_distance_to_position(x, y, z)

Returns the distance to a position in studs.

  • Parameters:

    • x [float] - X coordinate

    • y [float] - Y coordinate

    • z [float] - Z coordinate

  • Returns: float - Distance in studs (-1 if invalid)

tp.get_players_by_distance(exclude_team?, exclude_dead?)

Returns all players sorted by distance (closest first).

  • Parameters:

    • exclude_team [optional bool] - Exclude teammates (default: false)

    • exclude_dead [optional bool] - Exclude dead players (default: true)

  • Returns: table - Array of player entries with:

    • address [uint64] - Player address

    • distance [float] - Distance in studs

    • name [string] - Player name


Complete Examples

Teleport Tool

Player Distance ESP

Save/Restore Position

Last updated