Why My Day Cycle Code won't working? | Scripting Support

TARGET

I want to make a day / night cycle myself

PROBLEM

My script won’t work, here is the code:

-- VARIABLES --

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

local DayDuration = 3
local Tween = TweenService:Create(Lightning, TweenInfo.new(DayDuration * 60, Enum.EasingStyle.Linear), {ClockTime = 24})

-- LOOPS --

while wait(DayDuration * 60) do
	Tween:Play()
end

QUESTION

Why my code won’t work and no error show in the Output.
Is there another way to fix this?

Thanks
-Skectes

are you gonna play the tween first

-- VARIABLES --

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

local DayDuration = 3
local Tween = TweenService:Create(Lightning, TweenInfo.new(DayDuration * 60, Enum.EasingStyle.Linear), {ClockTime = 24})

-- LOOPS --

Tween:Play()
while wait(DayDuration * 60) do
	Tween:Play()
end

Oh!
I forgot to play it first

Thank you very much!

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