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
- Open StarterPlayer, then StarterPlayerScripts.
- Add a LocalScript and paste the code.
- Play. The numbers count down at the top of the screen.
- Change START_FROM and FINISH_TEXT to what you need.
Change it
- This counts on the player's own device, so it is for things like a start countdown. For a real shared timer, read a StringValue the server updates (see the Round timer script).
- Put the script in StarterPlayerScripts, not StarterGui. A script directly in StarterGui runs again every time the player respawns.
- Use a light TEXT_COLOR for dark backgrounds.
More in GUI
More Roblox tools
- Shirt and pants templatesFree Roblox clothing templates to download: hoodies, jerseys, jeans, joggers and more.
- Robux tax calculatorWork out what you receive after the marketplace fee, or what to charge.
- Robux to USD calculatorConvert earned Robux to dollars at a DevEx rate you can edit.
- Shirt and pants template makerColour each panel of the 585×559 clothing template and download it.
- Username generatorGenerate usernames that fit the 3–20 character rule.