I made a day and night cycle script that basically adds to the ClockTime/TimeOfDay
one problem is that I do it in a while task.wait() loop, which basically makes it very fast.
If I add a 0.1 wait for example, the cycle slows down (duh) but the sun/moon moves choppy
Here’s the script:
local Lighting = game:GetService("Lighting")
local Minute = 60
local CurrentTime = 12 * Minute
local Time = CurrentTime * 1.6
local Increment = 3
local IsDay = false
local IsNight = false
local NotedDay = false
local NotedNight = false
while task.wait(0.1) do -- choppy movement because of 0.1
Lighting:SetMinutesAfterMidnight(CurrentTime)
CurrentTime += Increment
Time = CurrentTime * 1.6
if Time <= 2400 then -- TimeOfDay: 24:00:00
if Time >= 629 and Time <= 1999 then -- If TimeOfDay == 06:30:00 and < 20:00:00
IsDay = true
if not NotedDay then
NotedDay = true
warn("TIME_SCIPT :: TIME: 6:30 (DAY, 6AM)")
end
elseif Time >= 2000 then -- If TimeOfDay == 20:00:00
IsNight = true
if not NotedNight then
NotedNight = true
warn("TIME_SCIPT :: TIME: 20:00 (NIGHT, 8PM)")
end
end
elseif Time >= 2400 then -- If TimeOfDay == The end of day
CurrentTime = 0 -- Reset day timer
NotedDay = false
NotedNight = false
end
end