As a Roblox developer, it is currently too hard to tween the Lighting’s ClockTime property to make day-night cycles.
The issue
When you set ClockTime to 24 or above, the property will automatically reset back to 0. This is a problem when you want to tween this property along with others through TweenService; If you tween ClockTime from 22 to 2, you will go back twenty hours in time instead of four hours forward. Normally the fix is to tween ClockTime from 22 to 26, but given that ClockTime resets to 0 for every value of 24 and above, your tween will clamp at midnight halfway through and never reach ClockTime = 2.
The workaround is to tween to ClockTime = 24 with one tween, and then to your next time with another. However, this introduces a lot of issues that are hard to solve. If you tween other properties alongside of ClockTime, how do you figure out what value your other properties should have to preserve the smooth transition between the two tweens? With a linear tween this is fairly simple to solve with a singular multiplication/division, but for the other types such as sine tweens this becomes a difficult problem.
The solution
When ClockTime is set above 24, apply a modulo of 24 instead of resetting it to 0. This means that you will be able to tween past midnight in one tween instead of two. This behavior will also put it in line with the TimeOfDay property where setting it to e.g. “50:00:00” will put it at “02:00:00”.