Player function returns the distance between the character’s head and the given
DataType/Vector3 point. It returns 0 if the player has no
This is useful when determining the distance between a player and another object or location in game.
If you would like to determine the distance between two non-player instances or positions, you can use the following:
local distance = (position1 - position2).magnitude
The location from which player’s distance to is being measured.
The distance in studs between the player and the location.
Measuring the Distance Between a Player and a Position
This example demonstrates how to measure the distance between a player’s
Player/Character and another location.
This code will print the distance of each player’s character from the origin (0, 0, 0):