I would like to make a clock like the one in Brookhaven RP. I could simply have a textlabel display the clock time from lighting but I would like it to be formatted like, 10:00 or 9:30 and not 21:00. Does anyone know how to do this? I have only seen tutorials for local clocks.
local Gui = --Put your gui here
function getLightingTime()
local totalMinutes = game.Lighting:GetMinutesAfterMidnight()
local hours = math.floor(totalMinutes / 60)
local minutes = math.floor(totalMinutes % 60)
local period
if hours < 12 then
period = "AM"
else
period = "PM"
hours -= 12
end
if hours == 0 then
hours = 12
end
return string.format("%02d:%02d %s", hours, minutes, period)
end
while true do
Gui.Text = getLightingTime()
wait()
end