Teleport Library Lua Environment
TP (Teleport) Library Documentation
The tp library provides functions for teleporting and position management.
Position
tp.get_position()
tp.get_position()Returns the local player's current position.
Returns:
tablewith fields:x[float] - X coordinatey[float] - Y coordinatez[float] - Z coordinatevalid[bool] - Whether position is valid
local pos = tp.get_position()
if pos.valid then
print("Position: " .. pos.x .. ", " .. pos.y .. ", " .. pos.z)
endtp.get_player_position(player_addr)
tp.get_player_position(player_addr)Returns a player's current position.
Parameters:
player_addr[uint64] - Player addressReturns:
tablewith fields:x[float] - X coordinatey[float] - Y coordinatez[float] - Z coordinatevalid[bool] - Whether position is valid
Teleportation
tp.to_position(x, y, z)
tp.to_position(x, y, z)Teleports the local player to coordinates.
Parameters:
x[float] - X coordinatey[float] - Y coordinatez[float] - Z coordinate
Returns:
bool- Success
tp.to_vector(position)
tp.to_vector(position)Teleports the local player to a vector3 position.
Parameters:
position[vector3] - Target positionReturns:
bool- Success
tp.to_player(player_addr, offset_x?, offset_y?, offset_z?)
tp.to_player(player_addr, offset_x?, offset_y?, offset_z?)Teleports to another player's position.
Parameters:
player_addr[uint64] - Target player addressoffset_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?)
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)
tp.offset(x, y, z)Moves the local player by a relative offset.
Parameters:
x[float] - X offsety[float] - Y offsetz[float] - Z offset
Returns:
bool- Success
tp.behind_player(player_addr, distance?)
tp.behind_player(player_addr, distance?)Teleports behind a player.
Parameters:
player_addr[uint64] - Target player addressdistance[optional float] - Distance behind (default: 5)
Returns:
bool- Success
Distance
tp.get_distance(player_addr)
tp.get_distance(player_addr)Returns the distance to a player in studs.
Parameters:
player_addr[uint64] - Player addressReturns:
float- Distance in studs (-1 if invalid)
tp.get_distance_to_position(x, y, z)
tp.get_distance_to_position(x, y, z)Returns the distance to a position in studs.
Parameters:
x[float] - X coordinatey[float] - Y coordinatez[float] - Z coordinate
Returns:
float- Distance in studs (-1 if invalid)
tp.get_players_by_distance(exclude_team?, exclude_dead?)
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 addressdistance[float] - Distance in studsname[string] - Player name
Complete Examples
Teleport Tool
Player Distance ESP
Save/Restore Position
Last updated