I am trying to find the distance between points and compare it with an integer which is the amount of studs.
1 | magnitude = (part 1. Vector 3 - part 2. Vector 3 ).magnitude |
2 |
3 | if magnitude < = 3 then |
4 |
5 | -- code |
6 | 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?
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.