Get closest torso?

I want to get the closest torsos position.

Help i really have no idea how to do this.

1 Like

It’s fairly easy. I’m gonna give you the steps on how to do it.

  1. Create a variable with no value, just assign it nil;
  2. Use a ipairs loop (I’ll call the two vars Index and Char) in the workspace (or wherever the characters you wanna find are);
  3. Check if the variable you made before (I’ll call it X) is nil, and if it is then assign the first Char as its value;
  4. If the variable isn’t equal to nil (so another character was found), check if the torso of X is closer than the torso of the current Char;
  5. When the loop is finished you will have the closest torso. If it’s inside a function, you can use return to return X’ torso and assign it as the value of a variable.
2 Likes

For closest torsos you have to firstly get your torso then other player’s torso and with Magnitude the distance of that 2 torsos store it in Table and repeating same with all torsos see what is the nearest distance