function meditation(moving,equipped) while moving == false and equipped do progress.Size = UDim2.new(0,0,1,-4) progress:TweenSize(UDim2.new(1, -4, 1, -4),"Out","Linear",10,false) if equipped == false or moving == true then frame.Visible = false break end wait(10) updateMagic:FireServer(orbSize) end end function moveDetect(speed) if equipped then if speed > 5 then moving = true meditating = false print("moving") else moving = false print("stoppedmoving") end end end
The problem here is
if equipped == false or moving == true then frame.Visible = false break end
only checks once so if moving = false while it checks once then during the 10second wait if moving turns true, it doesn't break the loop. How can i make it so that as soon as the char moves the while loop breaks?
This might work:
while true do if not equipped or moving == true then frame.Visible = false break end wait(0.1) -- Cooldown so it doesn't crash end