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

Why is there extra seconds added to my wait time?

Hey Guys,

Weird issue going on here, here's my code:

local Intermission = 15

-- Game loop

while true do
	Status.Value = "Waiting for more players..."
	
	repeat wait(1) until game.Players.NumPlayers >= 0
	for t = Intermission,0,-1 do
		Status.Value = "Intermission... "..t.." seconds remaining"
		wait(1)
	end
	wait(Intermission)

Whenever I run the code, after the countdown the status bar says "0 seconds remaining" for a good few seconds, like 5 or 10, and then it continues with the rest of the script.

There are no other waits in the script that are that long, so really unsure what's going on.

Any help would be really appreciated, thank you!!

1 answer

✓ Accepted answer

Could you just do

while game.Players.NumPlayers <= 0 then
	Status.Value = "Waiting for more players..."
end
Intermission  = 15 
for i = 0, Intermission do
	Status.Value = "Intermission... "..Intermission.." seconds remaining"
	print(Intermission) 
	Intermission= Intermission - 1 
	wait(1)
end

1 comment

0

Thank you so much!!

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