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

Help with Magnitude problem?

There is no error in the output.

local pointA = Vector3.new(-6.402, 0.71, 72.872) -- some position
local pointB = Vector3.new(game.Players.LocalPlayer.Character.Torso.Position) -- some other position
if (pointB - pointA).magnitude < 0.1 then
    print("Close Enough")
end

Need it to print when its close enough

1 comment

0

Is it within a while loop? Is filtering enabled on>

1 answer

✓ Accepted answer

Only checks magnitude once, add while loop.

while wait() do
local pointA = Vector3.new(-6.402, 0.71, 72.872) -- some position
local pointB = game.Players.LocalPlayer.Character.Torso.Position) -- Vector3.new shouldn't be used
if (pointB - pointA).magnitude < 0.1 then
    print("Close Enough")
end
end

1 comment

0

What do i use instead of vector3?

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