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

Why Doesn't this play a countdown right after the map spawns?

This is a server script inside of serverscriptservice.

--[[
	CONTROLS ROUNDS
	BY CHEEKYSQUID
	DO NOT DELETE
--]]

local replicatedstorage = game:GetService("ReplicatedStorage")
local status = replicatedstorage:WaitForChild('StatusValue')

while true do
--Intermission section
for i = 2,0,-1 do
	status.Value = "Intermission: ".. i
	wait(1)
end
status.Value = "Prepare to be Rushed!"
wait(3)
	_G.gameplayers = {}
	for i, v in pairs  (game.Players:GetPlayers()) do
		
		if v then
			table.insert(_G.gameplayers, v.Name)
		end
	end
local maps = replicatedstorage:WaitForChild('Maps')
local maplist = maps:GetChildren()
local selectedIndex = math.random(1, #maplist)
local map = maplist[selectedIndex]:Clone()
map.Parent = Workspace.ActiveMap
wait(1)
local spawns = map:WaitForChild('Spawns'):GetChildren()
	for _, player in pairs(game.Players:GetPlayers()) do
		if player and #spawns > 0 then
			local torso = player.Character:WaitForChild('Torso')
			local allspawns = math.random(1, #spawns)
			local randomspawn = spawns[allspawns]
			if randomspawn and torso then
				table.remove(spawns, allspawns)
				torso.CFrame = CFrame.new(randomspawn.Position + Vector3.new(0, 2, 0))
			end
			for i = 3,0,-1 do
				if i > 3 then
					status.Value = i
					wait(1)
				else
				status.Value = "GO!"
				end

for i = 90,0,-1 do
	status.Value = i.." seconds remaining!"
	wait(1)
end
status.Value = "Game over!"  
map:Destroy()
			end
		end
	end
	
end

It should go 3 2 1 GO! and then the 90,0,-1 do should play but it skips the 3 2 1 GO!

The part that is not working is

for i = 3,0,-1 do
				if i > 3 then
					status.Value = i
					wait(1)
				else
				status.Value = "GO!"
				end

1 answer

✓ Accepted answer
for i = 3,0,-1 do
	if i <= 3 and i > 0 then  -- check if "i" is less or equal to 3 and more than 0
		status.Value = i
		wait(1)
	else
		status.Value = "GO!"
	end
end

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