local Y=1 local u=Y*16 local d=1440 local R=game:GetService("\076\105\103\104\116\105\110\103")local T=tick()-(R:getMinutesAfterMidnight()/d)*u local n=T+u local P=d/u if Y==0 then Y=1 end repeat local Y=tick()if Y>n then T=n n=T+u end R:setMinutesAfterMidnight((Y-T)*P)wait(.066666666666667)until false

local dayLength = 1

local cycleTime = dayLength*16
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
