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

How do you find the distance between the edges of parts? (UNANSWERED)

Magnitude finds the distance between the center of parts, like this

print((workspace.Part1.Position - workspace.Part2.Position).magnitude)

But if you have large bricks, they can be touching and still have a fairly large magnitude. I was wondering if there was a way to find the distance between the edges of parts, aka the number of studs between them. It should not be affected by their size.

1 comment

0

Someone has to know...

1 answer

I don't know if this will help but this is what I am using at the moment

math.sqrt((part2.Position.X - part1.Position.X)^2 + (part2.Position.Z - part1.Position.Z)^2)

1 comment

0

That did not work. It did not give me a number even close to the distance between the edges of parts.

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