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

How can I find a local distance between 2 parts?

Asked by
Jo_Bot 67
6 years ago

This is what I have tried, but this finds the Global distance:

distanceX = part1.CFrame.X - part2.CFrame.X

I have experimented with CFrame.lookVector, but I couldn't get that working either. Does anyone know how I can accomplish this?

0
http://wiki.roblox.com/index.php?title=Magnitude <- Is this what you’re looking for? User#20279 0 — 6y

1 answer

Log in to vote
0
Answered by
Rare_tendo 3000 Moderation Voter Community Moderator
6 years ago

Vector.magnitude

print((part1.Position - part2.Position).magnitude)
0
This worked! Thankyou! Jo_Bot 67 — 6y
Ad

Answer this question