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

Does magnitude return the amount of studs between points?

I am trying to find the distance between points and compare it with an integer which is the amount of studs.

magnitude = (part1.Vector3 - part2.Vector3).magnitude

if magnitude <= 3 then

 -- code
end

If magnitude doesnt return the distance measured in studs the above if statement would not run even if the distance is less than 3 studs.

So, Does magnitude return the amount of studs between points?

2 comments

2

If you dont know anything I suggest you do research before asking as this question has been answered countless times

0

Also magnitude returns the distances if something e.g. Part.

1 answer

✓ Accepted answer

Yes, magnitude does return studs and they're the studs between a Vector3 value. Also, you should use magnitude = (part1.Position - part2.Position).magnitude instead of part1.Vector3 as position returns their Vector3 position.

2 comments

0

oh i forgot that you need to use .position. thx for the answer

0

No problem.

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