Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do I detect distance from one object to another? [closed]

Asked by 10 years ago

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

Locked by adark

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

1 answer

Log in to vote
1
Answered by 10 years ago

Yay.

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