local Noob = script.Parent local Part = workspace.Part local Part2 = workspace.Part1 local Fighting = script.Parent.FoundPlayer.Value ---------------------------- while Fighting == false do print("Still...") if Fighting == false then Noob.Humanoid:MoveTo(Part.Position) Noob.Humanoid.MoveToFinished:wait() end if Fighting == false then Noob.Humanoid:MoveTo(Part2.Position) Noob.Humanoid.MoveToFinished:wait() end end
I have another script to control Fighting
, But i think it's unnecessary to put it.
Then that is by question, Why this code still running?
If you set Fighting
to script.Parent.FoundPlayer.Value
, you set it to the literal value at that present time, rather than setting it to "Whatever the value is".
local Noob = script.Parent local Part = workspace.Part local Part2 = workspace.Part1 local Fighting = script.Parent.FoundPlayer -- Reference the BooleanValue instance, rather than the value ---------------------------- while Fighting.Value == false do -- Reference the value from the instance print("Still...") if Fighting.Value == false then -- Reference the value from the instance Noob.Humanoid:MoveTo(Part.Position) Noob.Humanoid.MoveToFinished:wait() end if Fighting.Value == false then -- Reference the value from the instance Noob.Humanoid:MoveTo(Part2.Position) Noob.Humanoid.MoveToFinished:wait() end end