This is an example of code where you REALLY need to tab every perfectly or else it will be confusing which end goes with which code block. So, let's do that.
if game.Players.NumPlayers >= 3 then
for i = 30,0,-1 do
script.Parent.Text = "Intermission "..i
wait(1)
end
for i = 60, 1, -1 do
script.Parent.Text = "Time Left: 2:" .. i
wait(1)
end
for i = 60, 1, -1 do
script.Parent.Text = "Time Left: 1:" .. i
wait(1)
end
for i = 60, 1, -1 do
script.Parent.Text = "Time Left: :" .. i
wait(1)
end
elseif game.Players.NumPlayers < 3 then
script.Parent.Text = "Waiting for more players..."
end
Now that it's readable, we can begin to debug.
You problem is that if statements only run once. The condition is either true or false. If it is true, then everything's fine and we proceed with the code. If it's false, we don't. It does not matter if the condition is true or false later, because the if statement will not run later.
It's kind of like if you do your homework or not. If you don't do your homework, you will get a bad grade. Your teacher doesn't give a crap if you do it the next day, because you didn't do it the time it was supposed to be done! It's the same in Lua. Who cares if this condition is true later? The computer essentially thinks. "It's not true now, and unless I'm told to check again later, I don't care what happens to it."
But this is not the only problem. Since a GUI will clone itself into a player's PlayerGui each time they respawn, if a player resets in the middle of the timer, the timer will start over. Therefore I recommend controlling all GUIs with a single string value in workspace, then using a server script to control that string value.
Server Script inside the string value in workspace:
while true do
if game.Players.NumPlayers >= 3 then
for i = 30,0,-1 do
script.Parent.Value = "Intermission "..i
wait(1)
end
for i = 60, 1, -1 do
script.Parent.Value = "Time Left: 2:" .. i
wait(1)
end
for i = 60, 1, -1 do
script.Parent.Value = "Time Left: 1:" .. i
wait(1)
end
for i = 60, 1, -1 do
script.Parent.Value = "Time Left: :" .. i
wait(1)
end
script.Parent.Value = "Countdown's over"
elseif game.Players.NumPlayers < 3 then
script.Parent.Text = "Waiting for more players..."
wait()
end
end
Local Script inside the GUI
script.Parent.Text = game.Workspace.StringValue.Value
game.Workspace.StringValue.Changed:connect(function()
script.Parent.Text = game.Workspace.StringValue.Value
end)