Advertisement
Cakey3101

12 Hour Clock Tutorial

Apr 16th, 2025
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.48 KB | Source Code | 0 0
  1. local Lighting = game:GetService("Lighting")
  2. local RunService = game:GetService("RunService")
  3.  
  4. local Label = script.Parent
  5.  
  6. RunService.PostSimulation:Connect(function()
  7.     local RawTime = Lighting.ClockTime
  8.     local Hours = math.floor(RawTime % 12)
  9.     local Minutes = math.floor((RawTime % 1) * 60)
  10.     local AM_PM = (RawTime >= 12 and RawTime < 24) and "PM" or "AM"
  11.  
  12.     if Hours == 0 then Hours = 12 end
  13.  
  14.     Label.Text = string.format("Time: %02d:%02d %s", Hours, Minutes, AM_PM)
  15. end)
  16.  
Tags: robloxstudio
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement