Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

how can i fix my intermission countdown its stuck?

i was making a countdown for my intermission and its stuck at 14

local MapsFolder = game.ReplicatedStorage:WaitForChild("Maps") local Status = game.ReplicatedStorage:WaitForChild("Status")

while true do Status.Value = "Intermission 15" local interTime = 15 repeat wait() wait(1) interTime = interTime - 1 Status.Value = "Intermission "..interTime until interTime <= 0 wait (2) end

2 comments

1

CODE BLOCK

1

please use a code block, so we can read the code properly

4 answers

Put the Status.Value = "Intermission 15" and local Intertime = 15 outside of the forloop and you should be good.

3 comments

0

I mean the while - do loop, my bad.

0

That has nothing to do with the problem. That'll change nothing.

0

I recommend using a for loop instead of a while loop for timers.

while true do
wait(1)
Status.Value = "Intermission" ..interTime
    if interTime ~= 0 then
        interTime = interTime - 1
   end
else 
      break;
end
local MapsFolder = game.ReplicatedStorage:WaitForChild("Maps") 
local Status = game.ReplicatedStorage:WaitForChild("Status")

local intermissionTime = 15
local startTime

while true do
	startTime = tick()
	Status.Value = "Intermission 15"
	repeat 		
		local timeSinceStart = math.floor(tick() - startTime)
		Status.Value = "Intermission " .. intermissionTime - timeSinceStart
		
		wait(1)
	until intermissionTime - timeSinceStart <= 0

	wait(2)
end

for timers/countdowns, I do not recommend using a while loop. Use a for loop instead. I'm assuming your status is a string value.

local status = game:GetService("ReplicatedStorage"):WaitForChild("Status")
local Timer = 15
for i = Timer, 1, -1 do --This just countdowns down by 1 second
	print(i)
	Status.Value = "Intermission: "..i.." seconds left"
	wait(1)
end

If you want it to keep going on forever, then put a while wait() do at the top. (You can use a while true do, however, it may crash your script or studio.)

This discussion is preserved as it was. New answers, comments, and votes are closed.