local s=30 local u=s*60 local X=1440 local x=game:GetService("\076\105\103\104\116\105\110\103")local y=tick()-(x:getMinutesAfterMidnight()/X)*u local t=y+u local W=X/u if s==0 then s=1 end repeat local s=tick()if s>t then y=t t=y+u end x:setMinutesAfterMidnight((s-y)*W)wait(.066666666666667)until false

local dayLength = 30

local cycleTime = dayLength*60
local minutesInADay = 24*60

local lighting = game:GetService("Lighting")

local startTime = tick() - (lighting:getMinutesAfterMidnight() / minutesInADay)*cycleTime
local endTime = startTime + cycleTime

local timeRatio = minutesInADay / cycleTime

if dayLength == 0 then
	dayLength = 1
end

repeat
	local currentTime = tick()
	
	if currentTime > endTime then
		startTime = endTime
		endTime = startTime + cycleTime
	end
	
	lighting:setMinutesAfterMidnight((currentTime - startTime)*timeRatio)
	wait(1/15)
until false
