← Back to Escape Room Scripts

Timer + Lose Script

Customize your variables, then fill in the blanks!

Your Custom Settings

How long to escape
ScreenGui name in StarterGui
TextLabel showing time
TextLabel for lose message

LocalScript (StarterGui)

This script counts down from your time limit and shows a lose message when time runs out. Create a ScreenGui with two TextLabels: one for the timer and one for the lose message (Visible = false)!

local player = game..LocalPlayer
local gui = player:WaitForChild("").timerGui
local timerLabel = gui.timerLabel
local loseLabel = gui.loseLabel
local timeLeft = 150
local function formatTime(seconds)
    local mins = math.(seconds / 60)
    local secs = seconds % 60
    return string.("%02d:%02d", mins, secs)
end
while timeLeft > 0 do
    timerLabel. = formatTime(timeLeft)
    task.(1)
    timeLeft = timeLeft - 1
end
timerLabel.Text = "00:00"
loseLabel. = true