Roblox Tutorial - How to make a day/night cycle source code

Source code:

local Lighting = game:GetService("Lighting")
local TweenService = game:GetService("TweenService")


local DayLength =  1 --In minutes
local DayLengthInSec = DayLength * 60
local WaitPerValue = DayLengthInSec / 20



while wait(WaitPerValue) do 
	local Next_Value = Lighting.ClockTime + 1
	print(Next_Value)
	TweenService:Create(Lighting, TweenInfo.new(WaitPerValue, Enum.EasingStyle.Linear), {ClockTime=Next_Value}):Play()
end
1 Like

This topic was automatically closed 1 minute after the last reply. New replies are no longer allowed.