Hello, I’m making a day/night cycle but the clock is “freezing” for a second.
This is due to the timer has no floor, like math.floor so it’s just 10.199999809265137 and I don’t know how to fix it.
The video and script are below.
Script for time
while wait(1) do
game.Lighting.ClockTime += 0.01
print("Time is now "..game.Lighting.ClockTime)
end
And the other thing is on how to keep the clock UI view 10:03 instead of 10:3
Clock UI Script
local lighting = game:GetService("Lighting")
while wait(.1) do
local hours = math.floor(lighting:GetMinutesAfterMidnight() / 60)
local minutes = lighting:GetMinutesAfterMidnight() - (hours * 60)
script.Parent.Text = hours..":"..math.floor(minutes)
end
If you want it to make it 05:30 then you should do Lighting:SetMinutesAfterMightnight(360) you should give it mins, since 5:30 is 60x 5 + 30 mins, so it makes it 5:30
Like this you can do easily, but clock time is meant for integers mostly like 0-24 so you might need to do alot of calculation to avoid messing up