while true do
local Hours = math.floor(game.Lighting:GetMinutesAfterMidnight()/60) --round hours
local Minutes = math.floor(game.Lighting:GetMinutesAfterMidnight() - (Hours * 60)) --take the amount of minutes already accounted for with the hours, then use that to get the minutes
if Hours > 12 then
Hours = Hours - 12
end
if Minutes < 10 then
Minutes = "0"..Minutes
end
script.Parent.Text = "⏰: "..Hours..":"..Minutes
wait()
end
In simple ways you can make it AM by default and if the hours is greater than 12 it’s set to PM via variable.
Also you can use a formatted string which allows for zeros padding
while true do
local Hours = math.floor(game.Lighting:GetMinutesAfterMidnight()/60) --round hours
local Minutes = math.floor(game.Lighting:GetMinutesAfterMidnight() - (Hours * 60)) --take the amount of minutes already accounted for with the hours, then use that to get the minutes
local timeThing = "AM"
if Hours > 12 then
timeThing = "PM"
Hours -= 12
end
script.Parent.Text = string.format("⏰: %d:%02d%s",Hours,Minutes,timeThing)
wait()
end
This will format the string accordingly using the hours, minutes with a zero padded if less than 10, and the timeThing
You can probably look up how exactly AM and PM works as this is just a barebones addition