I know I've asked a lot of questions about magnitude and this is the last one. Sorry if this looks like spam. I'm trying to only calculate a single magnitude at a time but when I'm really close to a part("ObjOne" in this case) then I want to run the calculation for "ObjTwo" and so on. I've looked over this several times and came up with nothing. All help is appreciated.
Module = require(script.ModuleScript)
Player = game:GetService("Players").LocalPlayer
Magnitude = {
Distance = 0;
}
function Magnitude.CalculateMagnitude(ObjOne, ObjTwo, ObjName)
for i = 0,10 do
if Magnitude.Distance <= 30 and ObjName == ("ObjOne") then
Print("Close to first objective")
elseif Magnitude.Distance <= 15 and ObjName == ("ObjTwo") then
Print("Close to second objective") end
Magnitude.Distance = math.ceil((ObjOne.Position - ObjTwo.Position).Magnitude)
script.Parent.Distance.Text = Magnitude.Distance
wait(0.25)
end
end
while true do
Magnitude.CalculateMagnitude(workspace.PrologueObjPoints.ObjOne, Player.Character.Torso, "ObjOne")
Magnitude.CalculateMagnitude(workspace.PrologueObjPoints.ObjTwo, Player.Character.Torso, "ObjTwo")
end
