Day/Evening/Night Cycle

I am currently working on a Burger restaurant type of game with a friend but I am unable to understand how to make a cycle for Day/Evening/Night. How would I go about this?

Periodically change the ClockTime property of Lighting.

Okay so I have to script the clock time to change every whenever I want it to?

game.Lighting.ClockTime = 14 --Change the number to what you want it to be

This is how you would change ClockTime.

Okay thanks but I am saying how would I do it if I trying to do a cycle (Then it can do it all by itself)

Make a while true do loop, and change the time periodically that way.

Alright would I have to include a wait for before every change to make it smoother or it does not need that?

wait() delays the script, not make it smoother, but it still is needed. Use TweenService to make the time transitioning smooth.

You would use the SetMinutesAfterMidnight function which axiomatically sets the time to the amount of minutes after midnight based on the parameter passed in. For this example we can keep track of the parameter using the minutesAfterMidnight variable. For example, this script would set it to one hour after midnight.

local minutesAfterMidnight = 60
game.lighting:SetMinutesAfterMidnight(minutesAfterMidnight)

To make it a cycle, you would use an infinite loop. Each time it cycles, it would add to the variable and then pass the variable in to the function.

local minutesAfterMidnight = 0
while true do
	minutesAfterMidnight = minutesAfterMidnight + 1
	game.Lighting:SetMinutesAfterMidnight(minutesAfterMidnight)
	wait(.1)
end

To make it smoother, change the wait parameter and the amount it increments.

No I mean smoother transition to the next time of day

Exactly. Use TweenService.

30chars