Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Layout:
- TimerGui
- - Frame
- -Localscript
- -StartTimer
- -EndTimer
- -TextLabel
- StartTimer and EndTimer are BindableEvents
- ]]--
- local startTimer = script.Parent.StartTimer
- local endTimer = script.Parent.EndTimer
- local gui = script.Parent
- local text = script.Parent.TextLabel
- local function timeToString(seconds)
- local minutes = math.floor(seconds / 60)
- local seconds = tostring(math.floor(seconds - (minutes * 60))
- )
- minutes = tostring(minutes)
- if string.len(minutes) == 1 then
- minutes = "0"..minutes
- end
- if string.len(seconds) == 1 then
- seconds = "0"..seconds
- end
- return minutes..":"..seconds
- end
- startTimer.Event:Connect(function(seconds)
- gui.Visible = true
- local startTime = os.clock()
- while os.clock() - startTime < seconds do
- text.Text = timeToString(seconds - (os.clock() - startTime))
- wait()
- end
- endTimer:Fire()
- gui.Visible = false
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement