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

A GUI with a timer on it?

I have a game for a friend. I'm helping. I want to know how to make a GUI with a timer. The timer is 60 all the way down to 0, but does nothing. After it is done, the GUI goes away. Help?

1 answer

In this scenario it's probably best to use a numeric for loop, your script probably would look something like this-

local g = ... -- location of your GUI element (i.e. TextLabel, TextBox)

function countdown(time)
	g.Visible = true
	for i = time, 0, -1 do -- for i = start_value, end_value, increment do
		g.Text = i
		wait(1)
	end
	g.Visible = false -- disappear after 60s
end

countdown(60) -- call countdown(time) whenever you want to display a countdown

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