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

Does magnitude return the amount of studs between points?

Asked by
Erie20 102
4 years ago

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
If you dont know anything I suggest you do research before asking as this question has been answered countless times JesseSong 3916 — 4y
0
Also magnitude returns the distances if something e.g. Part. JesseSong 3916 — 4y

1 answer

Log in to vote
2
Answered by 4 years ago
Edited 4 years ago

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

0
oh i forgot that you need to use .position. thx for the answer Erie20 102 — 4y
0
No problem. youtubemasterWOW 2741 — 4y
Ad

Answer this question