Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local RunService = game:GetService("RunService")
- local TIMER_BINDING_NAME = "Timer"
- local label = script.Parent
- local function startTimer(timeLeft)
- local delayEvent = Instance.new("BindableEvent")
- RunService:BindToRenderStep(TIMER_BINDING_NAME, Enum.RenderPriority.Last.Value - 1, function(delta)
- -- delta is the time since the last frame
- -- 01:30:01
- timeLeft -= delta
- local minutes = math.floor(timeLeft / 60)
- local seconds = math.floor(timeLeft % 60)
- local hundreths = math.floor(timeLeft % 1 * 100)
- label.Text = string.format("%02i:%02i:%02i", minutes, seconds, hundreths)
- if timeLeft <= 0 then
- delayEvent:Fire()
- RunService:UnbindFromRenderStep(TIMER_BINDING_NAME)
- end
- end)
- delayEvent.Event:Wait()
- end
- startTimer(10)
- label.Text = "Done"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement