Advertisement
RyanDaCoder

ROBLOX real-time clock script

Mar 31st, 2019
1,687
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. math.randomseed(tick())
  2.  
  3. function GetLocalTime()
  4. local TiF = "%.2d:%.2d:%.2d"
  5. local t = tick()
  6. return TiF:format(math.floor((t/3600)%24),math.floor((t/60)%60),math.floor((t%60)))
  7. end
  8.  
  9. while wait() do
  10. script.Parent.Text = GetLocalTime()
  11. local hours, mins = string.match(script.Parent.Text, "^(%d%d):(%d%d)")
  12. if tonumber(hours) > 12 then
  13. hours = hours - 12
  14. script.Parent.Text = hours..":"..mins.." PM"
  15. else
  16. script.Parent.Text = hours..":"..mins.." AM"
  17. end
  18. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement