Hello, I am trying to attempt a day and night cycle. However, I need the times to adjust to an increase in interval. How the system works is that initially daytime will be 180 seconds but every day it will decrease by 30. Also, nighttime is initially 60 seconds but increases by 20 seconds every day. I need the time to adjust for this, but I am not sure how to do this arithmetic. The code is provided below.
local Duration = 180 (DAY TIME) (DECREASE)
local Inside = 30 (AFTERNOON) (STILL)
local Diff = 60 (NIGHT) (INCREASE)
while true do
game.Lighting.FogEnd = 750
game.Lighting.FogColor = Color3.new(0.4, 0.631373, 0.737255)
game.Lighting.ClockTime = 12
for i = Duration, 1, -1 do
updateCountdownLabel("Gather resources: " β¦ tostring(i))
task.wait(1)
game.Lighting.ClockTime += 0.02
end
game.Lighting.FogEnd = 500
game.Lighting.FogColor = Color3.new(0.247059, 0.396078, 0.458824)
--game.Lighting.ClockTime = 6
for i = Inside, 1, -1 do
updateCountdownLabel("Get in the cabin and close the door: " .. tostring(i))
task.wait(1)
game.Lighting.ClockTime += 0.05
end
game.Lighting.FogEnd = 50
game.Lighting.FogColor = Color3.new(0, 0, 0)
--game.Lighting.ClockTime = 24
updateCountdownLabel("Stay in the cabin and survive: " .. tostring(i))
spawnZombie()
task.wait(1)
game.Lighting.ClockTime += 0.05
end
if Duration > 30 then
Duration -= 30
end
Diff += 20
end