Advertisement
Dodikman

Simple timer for Roblox

Mar 31st, 2019
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.90 KB | None | 0 0
  1. local plr = game.Players.LocalPlayer
  2. local gui = Instance.new("ScreenGui")
  3. gui.Parent = plr.PlayerGui
  4. gui.ResetOnSpawn = false
  5. local timer = Instance.new("TextLabel")
  6. timer.Parent = gui
  7. timer.BackgroundTransparency = 1
  8. timer.Size = UDim2.new(0.125, 0, 0.125, 0)
  9. timer.Position = UDim2.new(0, 0, 0.5 ,0)
  10. timer.TextXAlignment = Enum.TextXAlignment.Center
  11. timer.TextScaled = true
  12. timer.Text = "00:00:00"
  13. timer.TextColor3 = Color3.new(255, 255, 255)
  14. timer.Font = Enum.Font.Code
  15. local x = 0
  16. local y = 0
  17. local z = 40
  18. while wait(1) do
  19.     if z >= 60 then
  20.         y = y + 1
  21.         z = 0
  22.     end
  23.     if y >= 60 then
  24.         x = x + 1
  25.         y = 0
  26.     end
  27.     local tz = "00"
  28.     local ty = "00"
  29.     local tx = "00"
  30.     if z >= 10 then
  31.         tz = z
  32.     else
  33.         tz = "0" .. z
  34.     end
  35.     if y >= 10 then
  36.         ty = y
  37.     else
  38.         ty = "0" .. y
  39.     end
  40.     if x >= 10 then
  41.         tx = x
  42.     else
  43.         tx = "0" .. x
  44.     end
  45.     timer.Text = tx .. ":" .. ty .. ":" .. tz
  46.     z = z + 1
  47. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement