Hi, I am trying to make a day night cycling system with tweenservice, and the only problem I have right now is that the sun goes down in the same direction where it came. It’s supossed to go all around but that isn’t happening.
I am fairy new to usng tweenservice, and I tried to find solutions on the dev forums but couldnt find anything for this specific problem.
Would be really happy if somebody can tell me what the problem is so I can change it and hopefully learn from it as well:))
my code:
local Time = {}
Time.__index = Time
local TweenService = game:GetService("TweenService")
local Lighting = game:GetService("Lighting")
local DayTime = 0.1 --in minutes
local DayCycle = DayTime*60
local NightTime = 0.1
local NightCycle = NightTime*60
local Transition = 0.1*60
local TweenInf = TweenInfo.new(Transition,Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
local TweenToDay = TweenService:Create(Lighting, TweenInf, {ClockTime = 13})
local TweenToNight = TweenService:Create(Lighting, TweenInf, {ClockTime = 4})
-------local functions--------
-------module functions--------
function Time:Init()
while true do
TweenToDay:Play()
TweenToDay.Completed:Wait()
wait(DayCycle)
TweenToNight:Play()
TweenToNight.Completed:Wait()
wait(NightCycle)
end
end
return Time