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

Distance between two blocks

How would I figure out the distance between two blocks. Would I use magnitude?

1 answer

✓ Accepted answer
local part1 = Instance.new("Part", workspace)
part1.Position = Vector3.new(0, 20, 0)
local part2 = Instance.new("Part", workspace)
part2.Position = Vector3.new(0, 0, 0)
print((part1.Position-part2.Position).magnitude) --20

Every Vector3 has a magnitude. In the above example, it is used to get the distance of studs of two parts. See more here.

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