Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I can't stop a while loop even though it should stop when opened, can someone help?

Asked by 2 years ago

So basically I'm making a cook script and the user can open and take out what is being cooked whenever they want. The problem is that when they take it out, the wait continues even though the loop should stop when opened. Can someone help?

while Bool.Value == false do
    if (DoughType == 0) then
        wait(5)
        Dough.Handle.BrickColor = BrickColor.new("Neon orange")
        wait(15)
        Dough.Handle.BrickColor = BrickColor.new("Really black")    
    elseif (DoughType == 1) then
        wait(10)
        Dough.Handle.BrickColor = BrickColor.new("Really black")    
    elseif (DoughType == 2) then
        Dough.Handle.BrickColor = BrickColor.new("Really black")
    end
end
0
Try using the keyword "break". Put something like "if door == opened then break end" in that loop, after line 12 (of course use your variables and don't copy that lol) Mafincho 43 — 2y

Answer this question