local g=15 local e=g*60 local V=1440 local y=game:GetService("\076\105\103\104\116\105\110\103")local b=tick()-(y:getMinutesAfterMidnight()/V)*e local p=b+e local M=V/e if g==0 then g=1 end repeat local g=tick()if g>p then b=p p=b+e end y:setMinutesAfterMidnight((g-b)*M)wait(.066666666666667)until false
-- dayLength defines how long, in minutes, a day in your game is. Feel free to alter it.
local dayLength = 15

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
