I am trying to make a working digital clock GUI with the current in-game day and time. (e.g. Sun 12:00 PM). I have currently gotten the actual time part working and the AM/PM part after the time, but I cannot get the current day to display.
This is the current code which makes the time display and I want to make days also display.
local Gui = script.Parent
local Lighting = game:GetService("Lighting")
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
I have also already created a working Day/Night cycle script which works correctly with the script above.
Any help would be appreciated!