I would be very thankful to person who answer my question with having a time. Reason why I am asking this is I see a lot of .manitude >= number in scripts and I really want to know what it is, so If anyone can take some time and explain me that, I would be very thankful and I would reward them with accepting thir answer. Thanks for everyone who can help me and who have a time for this.
Magnitude means the length of a vector (distance between two points). It's used in ROBLOX to find the distance between two positions, using the formula "sqrt(x2 + y2 + z2)" according to the wiki. People use > to see if the distance is at a certain point to do a certain thing such as alert a player. You can learn more in depth about this here.
Example
1 | local position 1 = workspace.Part 1. Position |
2 | local position 2 = workspace.Part 2. Position |
3 |
4 | local distance = (position 2 - position 1 ).Magnitude -- find distance between two parts |
5 |
6 | if distance > 5 then |
7 | -- do stuff... |
8 | end |