Help with Day and night cycle

So, I’m using a day and night cycle and I’m trying to make it so when it’s a certain distance to night the fog and the brightness starts to change. here is how I’m doing it:

if lighting.ClockTime >= NightTime - .5 then
		if lighting.Brightness > 0 then
			lighting.Brightness -= .025
		end
		if lighting.FogEnd > 100 then
			lighting.FogEnd -= 5
		end
		if lighting.FogStart > 25 then
			lighting.FogStart -= 1
		end
	end

Ik this is not the most efficient way but idk how else to do it. problem is that this doesn’t work with color of fog. help needed