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

1 comment

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)