Answers for "day night cycle roblox"

0

day night cycle roblox

local length = 12
--length is in minutes

local cycle = length*60
local minutes = 24*60

local lighting = game:GetService("Lighting")

local start = tick() - (lighting:getMinutesAfterMidnight() / minutes)*cycle
local TimeEnd = start + cycle

local Ratio = minutes / cycle

if length == 0 then
	length = 1
end

repeat
	local current = tick()
	
	if current > TimeEnd then
		start = TimeEnd
		TimeEnd = start + cycle
	end
	
	lighting:setMinutesAfterMidnight((current - start)*Ratio)
	wait(1/15)
until false
Posted by: Guest on July-31-2021

Code answers related to "day night cycle roblox"

Browse Popular Code Answers by Language