Tween doesnt go in the right direction

I want this day/night cycle to go normally. However, it doesnt go in the same direction! I have tried setting the tween values to 11.9, 12.1 and 0.1 to make one shorter and one longer but it hasnt worked.

local interval = 10
local twinfo = TweenInfo.new(interval,Enum.EasingStyle.Exponential, Enum.EasingDirection.In, 0, false)
local twinfo2 = TweenInfo.new(interval,Enum.EasingStyle.Exponential, Enum.EasingDirection.Out, 0, false)
local val = true

while wait(interval) do
	if val then
		val = false
		game.TweenService:Create(game.Lighting, twinfo, {ClockTime = 0}):Play()
		print("Playing to 2")
	elseif not val then
		val = true
		game.TweenService:Create(game.Lighting, twinfo2, {ClockTime = 12}):Play()
		print("Playing to 14")
	end
end

In {ClockTime = 0}, make it 24 instead, since it is the same time position as 0

Then it will loop smoothly

1 Like

The problem here is that TweenService treats ClockTime as if it was any other value. And the only way to tween from 12 to 0 is by decreasing the number.
As @Victor_Holly123 said, you can work around this by tweening it to 23.9, and then manually resetting the ClockTime by setting it back to 0.

1 Like

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