Skinstashery
Roblox
Home / Roblox / Studio script library / Countdown GUI
RB-004

Roblox countdown gui script

Draws a big countdown on the screen, then shows GO! and hides it.

Script type
LocalScript
Where it goes
StarterPlayer > StarterPlayerScripts
Category
GUI

For your own game in Roblox Studio. Not for use in other people's games.

The code

-- Countdown GUI: builds its own ScreenGui and counts down. No setup in the editor.

local START_FROM = 10
local FINISH_TEXT = "GO!"
local HIDE_AFTER = 2          -- seconds the finish text stays on screen
local TEXT_COLOR = Color3.fromRGB(29, 28, 24)

local Players = game:GetService("Players")

local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")

local screenGui = Instance.new("ScreenGui")
screenGui.Name = "CountdownGui"
screenGui.ResetOnSpawn = false      -- keep it when the character resets
screenGui.Parent = playerGui

local label = Instance.new("TextLabel")
label.AnchorPoint = Vector2.new(0.5, 0)
label.Position = UDim2.new(0.5, 0, 0.1, 0)
label.Size = UDim2.new(0, 300, 0, 100)
label.BackgroundTransparency = 1
label.Font = Enum.Font.GothamBold
label.TextSize = 80
label.TextColor3 = TEXT_COLOR
label.TextStrokeTransparency = 0.5
label.Text = tostring(START_FROM)
label.Parent = screenGui

for secondsLeft = START_FROM, 1, -1 do
	label.Text = tostring(secondsLeft)
	task.wait(1)
end

label.Text = FINISH_TEXT
task.wait(HIDE_AFTER)
screenGui:Destroy()

How to set it up

  1. Open StarterPlayer, then StarterPlayerScripts.
  2. Add a LocalScript and paste the code.
  3. Play. The numbers count down at the top of the screen.
  4. Change START_FROM and FINISH_TEXT to what you need.

Change it

More in GUI

All Roblox scripts

More Roblox tools