You could stop the while loop when reaching certain time of lighting, very basic example:
local StopNow = 17 -- Time to stop
local Step = 0.01 -- wait time for each update
local timechange = 1
while game.Lighting.ClockTime < StopNow do
game.Lighting.ClockTime = game.Lighting.ClockTime + timechange
Sure, the variable called “stopTime”, is a number 1.
Each time the while loop repeats, sums 1 to stopTime variable, and the while loop will run only if stopTime is less than 5, after 4 times the while loop repeats, the stopTime variable will reach 5, and 5 is not less than 5, then the while loop will stop.
The statement is: while the variable stopTime is less than 5, continue, else it breaks.