So… made an Countdown script for my game “YoB”, the problem is just that every player gets their countdown reset and i don’t know how to change it. Can somebody help me with this? Just asking and thank you for your help
The Videos of the bug (Recorded at the same time):
The Script:
local countdownUI = script.Parent
local Countdown
local RoundStarted = false
local CharacterSelect = false
local Lobbymusic = game.SoundService:FindFirstChild("I'm Sad but I Don't Know Why (Lobby Theme)")
local countdownsound = script.Countdown
local countdownsoundlastseconds = script["Countdown (last seconds)"]
local CSMusic = game.SoundService:FindFirstChild("Character Select (Placeholder)")
local PlaceholderMusic = game.SoundService:FindFirstChild("Test Stage")
local function StopAllMusic()
if Lobbymusic and Lobbymusic.IsPlaying then
Lobbymusic:Stop()
end
if CSMusic and CSMusic.IsPlaying then
CSMusic:Stop()
end
if PlaceholderMusic and PlaceholderMusic.IsPlaying then
PlaceholderMusic:Stop()
end
end
while true do
if RoundStarted == false and CharacterSelect == false then
StopAllMusic()
Lobbymusic.Looped = true
Lobbymusic:Play()
Countdown = 50
while Countdown > 0 do
countdownUI.Text = "Intermission: "..Countdown
wait(1)
if Countdown > 4 then
countdownsound:Play()
else
countdownsound:Stop()
countdownsoundlastseconds:Play()
end
Countdown = Countdown -1
end
countdownUI.Text = "Intermission: "..Countdown
CharacterSelect = true
end
if RoundStarted == false and CharacterSelect == true then
Lobbymusic.Looped = false
StopAllMusic()
CSMusic:Play()
Countdown = 20
while Countdown > 0 do
countdownUI.Text = "Character Select: "..Countdown
wait(1)
if Countdown > 4 then
countdownsound:Play()
else
countdownsound:Stop()
countdownsoundlastseconds:Play()
end
Countdown = Countdown -1
end
countdownUI.Text = "Time: "..Countdown
CharacterSelect = false
RoundStarted = true
end
if RoundStarted == true and CharacterSelect == false then
StopAllMusic()
PlaceholderMusic:Play()
Countdown = 120
while Countdown > 0 do
countdownUI.Text = "Time: "..Countdown
wait(1)
if Countdown > 4 then
countdownsound:Play()
else
countdownsound:Stop()
countdownsoundlastseconds:Play()
end
Countdown = Countdown -1
end
end
countdownUI.Text = "Character Select: "..Countdown
CharacterSelect = false
RoundStarted = false
end