I'm making a break system for my game, but the countdown stops every time I test the game.
The script I've made so far:
local timer = game.StarterGui.Timer.TimerText local lobbyMusic = game.Workspace.Sounds.Intermission local inGameMusic = game.Workspace.Sounds.InGame local storage = game:GetService("ReplicatedStorage") local intermissionCountdown = storage.Values.IntermissionCounter local ingameCountdown = storage.Values.InGameCounter local status = storage.Values.Status local maps = storage.Maps if status.Value == "Intermission" then repeat wait(1) intermissionCountdown.Value = intermissionCountdown.Value - 1 timer.Text = "Intermission:" ..intermissionCountdown.Value until intermissionCountdown.Value <= 0 end
instead of doing that. Try a for loop.
local timer = game.StarterGui.Timer.TimerText local lobbyMusic = game.Workspace.Sounds.Intermission local inGameMusic = game.Workspace.Sounds.InGame local storage = game:GetService("ReplicatedStorage") local intermissionCountdown = storage.Values.IntermissionCounter local ingameCountdown = storage.Values.InGameCounter local status = storage.Values.Status local maps = storage.Maps if status.Value == "Intermission" then for i=1, 15, -1 do task.wait(1) intermissionCountdown.Value = i timer.Text = "Intermission: .. i repeat wait() until intermissionCountdown.Value <= 0 if intermissionCountdown.Value <= 0 then break end end end