We use cookies on this site to enhance your user experience



Sep 16 2019, 11:02 PM PST

Magnitude is a mathematical term which can mean several things. In vector theory, magnitude is the length of a vector.

Roblox has a special property for datatype/Vector3|Vector3 and datatype/Vector2|Vector2 values that finds the magnitude for you, accessible as follows:

local vec3 = Vector3.new(0, 10, 5)
local magnitude = vec3.Magnitude
local magnitude = workspace.Part.Position.Magnitude
local magnitude = workspace.Part.Size.Magnitude

As you can see, any datatype/Vector3|Vector3 or datatype/Vector2|Vector2 has the magnitude property, making it easy to find the distance between two points:

local magnitude = (workspace.Part1.Position - workspace.Part2.Position).Magnitude
  • distance
  • vector