Simple Day & Night Cycle

Very simple but effective day and night script
 avatar
unknown
lua
4 years ago
451 B
4
Indexable
--- C0MMAND4NT's simple Day & Night Cycle
--- value a is the number of minutes your day will be
--- so right now, a=10, so each day is 10 minutes long ingame
local a=10
local d=a*60
local _=24*60
local b=game:GetService("Lighting")
local e=tick()-(b:getMinutesAfterMidnight()/_)*d 
local c=e+d 
local _=_/d if a==0 
then a=1 end 
repeat local a=tick() 
if a>c then e=c c=e+d 
end b:setMinutesAfterMidnight((a-e)*_) wait(1/15)
until false
Editor is loading...