Getting Distance to Nearest Player?

How would I get the distance between a player and the player closest to him/her?

loop through all the players, store the lowest distance to the player and the player who had it, then after the loop that player is closest

To find distance difference, would I then just do this?:


target:GetPos()-ply:GetPos()

A vector minus a vector is another vector. You want a raw number that represents units of distance, right?

vector:Distance(vector)

ply:GetPos():Distance(target:GetPos())

Awesome! Thanks :smiley: (both of you)