Best way to detect players making a line?

Hey ya’ll. I’m trying to approach making a system that detects when the local player is in line with other 2 or more players, so they must be standing beside eachother not necessarily facing the same direction but yes next to eachother in a straight line pattern. Also i dont want it to be super strict, so it doesnt stop detecting a line if one players moves a bit or turns arround.

What would be the best, and least laggy way of achieving this?

You will need to go through the characters and if there’s a short distance, find a 3rd character. If the 3rd character is in the same unit vector (or very close) as the direction of the other 2, it’s a line.

1 Like

I had to edit my topic a bit, but your comments is of much help, thank you! i’ll try to script it and i’ll let you know how it turned out