--/CONFIG


local hoursInDay = dayEnd-dayStart
local hoursInNight = 24-hoursInDay
local day = true

local originalFog = game.Lighting.FogColor

while true do
	local updateDelta = wait(updateTick)
	local step = 0
	if game.Lighting.ClockTime >=dayStart and game.Lighting.ClockTime <=dayEnd then
		step = hoursInDay/daytimeInSeconds
		if not day then
			day = true
			local tween = TweenService:Create(game.Lighting,FogTweenInfo,{FogColor = originalFog})
			tween:Play()
		end
	else
		step = hoursInNight/nightInSeconds
		if day then
			day = false
			local tween = TweenService:Create(game.Lighting,FogTweenInfo,{FogColor = Color3.fromRGB(50, 56, 66)})
			tween:Play()
		end
	end
	game.Lighting.ClockTime += step*updateDelta
end
