How to tween daynightcycle

I have a DayNightCycle, but I want it to tween, so that the sun doesn’t sutter/lag when moving.
This is my script

local Lighting = game:GetService(“Lighting”)
local TS = game:GetService(“TweenService”)
local Tween = TweenInfo.new(5, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)

local Minutes = 660

while true do

Minutes = (Minutes + 1) % 1440
TS:Create(Lighting, Tween, {}):Play()
Lighting:SetMinutesAfterMidnight(Minutes)
wait(5)

end

Just resending the script so it’s easier to read for others:

local Lighting = game:GetService(“Lighting”)
local TS = game:GetService(“TweenService”)
local Tween = TweenInfo.new(5, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)

local Minutes = 660

while true do

Minutes = (Minutes + 1) % 1440
TS:Create(Lighting, Tween, {}):Play()
Lighting:SetMinutesAfterMidnight(Minutes)
wait(5)
end

How did you send it like that? I tried to, but it just didn’t format right

1 Like

Type three backticks before your code and three backticks after.

Backtick: `

I tried, but the code didn’t format right

I found a solution, but thanks though.

Three of this before the code and after: `

What is it? (So other people with the same problem can know)

local Lighting = game:GetService("Lighting")
local TS = game:GetService("TweenService")
local totalOfSeconds = 3600 --realtime seconds
local Tween = TweenInfo.new(totalOfSeconds, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut,-1,false,0)
Lighting.ClockTime = 0
TS:Create(Lighting, Tween, {ClockTime = 24}):Play()```
1 Like

Mark this one as the solution instead the other post :wink:

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