Advertisement
Hasli4

RBLX. TimerScript

May 15th, 2025
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.76 KB | None | 0 0
  1. function Round(n, decimals)
  2.     decimals = decimals or 0
  3.     return math.floor(n * 10^decimals) / 10^decimals
  4. end
  5. local last_time = 0
  6.  
  7. local debounce = true
  8. local BeginRace = game.Workspace.Start.BeginRace
  9. local EndRace = game.Workspace.Finish.EndRace
  10. local TextLabel = script.Parent.TextLabel
  11. while true do
  12. if BeginRace.Disabled and debounce then
  13.         debounce = false
  14.         local timer_status = true
  15.         local timeStart = tick()
  16.         while timer_status do
  17.             local raceTimeResult = tick() - timeStart
  18.             raceTimeResult = Round(raceTimeResult, 2)
  19.             last_time = raceTimeResult
  20.             TextLabel.Text = "Time:"..tostring(last_time)
  21.             if EndRace.Disabled then
  22.                 timer_status = false
  23.                 wait(5)
  24.                 debounce = true
  25.                 break
  26.             end
  27.             wait()
  28.         end
  29.     end
  30.     wait()
  31. end
  32.  
  33.  
  34.  
  35.  
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement