Timer Script not working

I was trying to make a countdown script for a round game, but it didn’t work as planned. The countdown isn’t shown on a GUI, instead it is an object in the game.

Nothing happens when the script runs.

Round script inside serverscriptservice:

local roundLength = 15
-- set to smaller values to save time while testing
--How long the rounds are - later set to 90 for 90 seconds
local intermissionLength = 5
-- How long the intermmison is - later set to 15 for 15 seconds
local inRound = game.ReplicatedStorage.InRound
local status = game:GetService("ReplicatedStorage").Status
local lobbySpawn = game.Workspace.Base.Spawns
-- make sure to specify the spawns with a for loop
local gameAreaSpawn1 = workspace.Voice.Playplace.VoiceTeleport
local gameAreaSpawn2 = workspace.Challenge.Playplace.ChallengeTeleport
--this teleports to the actual game area
local function roundTimer()
	while wait() do 
		for i = intermissionLength, 1, -1 do
			inRound = false
			status.Value = "Intermission: " .. i .. " seconds left!"
--intermission countdown
		for i = roundLength, 1, -1 do
			inRound = true
			status.Value = "Game: " .. i .." seconds left!"
-- round countdown

Here is the other script, inside the SurfaceGui in the countdown block.

local status = game.ReplicatedStorage.Status
local timerDisplay = script.Parent.TimerDisplay
	status.Value = timerDisplay.Text

I tried debugging it and it seems that the changed function never runs, if that is of assistance.

Please inform me if you need more info to assist, and of what.


Swap this around and put 1 first for both of the for loops. Then try it.

1 Like

Should I do the same with the roundLength?

Yes do that as well, let me know if it works.

1 Like

Yeah, it didn’t really work. It may be my laptop because sometimes stuff doesn’t work on my laptop that works on other people’s devices.

Do you have any other suggestions?

Do you want the round countdown to start after intermission has completed?

1 Like

Yes, I do want the intermission to come first, then the round.

Have you got any errors on the Output?

Would it have something to do with the fact that the second script which has the status changed function being a regular script?

No, there are no errrors in the output.

Try the original code you posted at the start but remove the spaces in between the 2 … on both sides and for all places they exist.

Changed it, nothing happened

Script one selected in the explorer

Second script, selected in the explorer

Under this line you should add

for i = intermissionLength,1,-1 do
if i == 0 then 
inRound = false


for i = intermission, -1 do
		if i == 1 then

both could work either way

I just realised are you calling the roundtimer function at the bottom of the script by doing roundTimer()


Swap the 5th line assignment …

Sorry to everyone I didn’t respond to, I had to go to sleep. However, I think the problem might be that I never called the roundTimer function like @IEnforce_Lawz said. Testing it rn

Turns out the problem was fixed by @TheLegendaryDragon99 and @IEnforce_Lawz. I will remember to not make this many dumb mistakes next time, thanks!