Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I detect distance from one object to another?

I am trying to get a lockon system that detects the nearest enemy and fires a script. What's the best way?

1 answer

Yay.

local Distance = (part1.Position - part2.Position).magnitude
print(Distance)

This discussion is preserved as it was. New answers, comments, and votes are closed.