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

How could I do this?

So recently, I got help from someone showing me how to do something like this: 0:10 0:08 0:07 and so on.

I tried to make something that goes like this for minutes: 1:02 1:01 1:00 0:59 and so on, but it's not working so I was wondering if someone could show me how to implement this. Thank you!

Countdown:

function roundCountdown()
	for countDown = 10, 0, -1 do
		playerNotification('Time left!')
	if countDown > 9 then
		playerCountdown('0:'..countDown)
	else
		playerCountdown('0:0'..countDown)
			wait(1)
		end
	end
end

1 answer

You have the wait inside the else block, so it isn't going to wait if countDown > 9 is true.

Use two for loops to handle minutes if you don't want to use modulo. You can shorten it more by using string.format:

function roundCountdown()
	for min=2,0,-1 do
		for sec=59,0,-1 do
			playerNotification('Time left!')
			playerCountdown(string.format("%d:%.2d",min,sec))
			wait(1)
		end
	end
end

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