Players.GetClosest

Declaration

Players.GetClosest(Vector3 Position)

Description

Returns the Player object for the closest player relative to Position. If not found, returns a Player object with ID set to -1.

--Prints out the name of the closest player to the position in the Scripts Console
local position = V3(2, 1, 2);
local closestPlayer = Players.GetClosest(position);

Print(closestPlayer.Name);

Declaration

Players.GetClosest(Tile Tile)

Description

Returns the Player object for the closest player relative to Tile. If not found, returns a Player object with ID set to -1.

--Prints out the name of the closest player to the tile in the Scripts Console
local tile = World.GetTile(V2(1, 5), 0);
local closestPlayer = Players.GetClosest(position);

Print(closestPlayer.Name);