Tweening Clock Time Issue?

Youre right it doesn’t, but thats not what im saying, im saying it continues until it reaches the goal which it never will

I’m still confused, you’re saying it repeats infinitely and it shouldn’t? Or it only plays once but ends after one cycle?

Omg Thank You! I feel like an idiot for this,

This is the script:

function WeatherHandler:CreateDayCycle(
	Time: number,
	EasingStyle: Enum.EasingStyle,
	EasingDirection: Enum.EasingDirection

		local T = game.TweenService
			math.clamp(Time, 1, 10), -- Me randomly playing with math LOL
			--math.huge Useless
			{ClockTime = 48}):Play()
		if game.Lighting.ClockTime == 0 then
		game.Lighting.ClockTime = 23.999
1 Like

Heya, I just so happened to check this website and saw @Developing_Scripter mention my resource. A better way to loop your tween would be by using Tween.Completed:Connect().

--PHASE 1, Create Tween

local Tween = game:GetService("TweenService"):Create(game.Lighting,, Enum.EasingStyle.Linear, Enum.EasingDirection.In,0,false,0), {ClockTime = 23.99})

--PHASE 2, Connect RBXScriptSignal (Event) to function


game.Lighting.ClockTime = 0

Tween:Play() --Loop



Tween:Play() --Launch Phase 1

This method helps you be 100% sure your tween is finished and will not fail on you.

1 Like

Thanks, but with the other script, i better results

Edit: @jadednova This still doesnt work

It works perfectly. Remember to place it in a script in a valid container such as ServerScriptService.

I did this:

function LightingService:CreateDayCycle(
	Time: number,
	EasingStyle: Enum.EasingStyle

	local T = game.TweenService

	local A = T:Create(game.Lighting,,EasingStyle,Enum.EasingDirection.InOut),{ClockTime = 23.999})
	local B = T:Create(game.Lighting,,EasingStyle,Enum.EasingDirection.InOut),{ClockTime = 11.999})
		game.Lighting.ClockTime = 0


You put A:Play() inside a function. This will not run until you call the function, which seems to perhaps be inside a Module.

I fixed up your script and it works.

It is inside a function, and yes it does

(didint read right, youre right about that, but still, it works how i intend it to)

I’ll reply for a final time, the script works and is better than a conditional statement that relies on ClockTime. The context to this is that Tween does not always tween exactly to the value you want it to be (ex. 23.684930349 instead of 23.99), therefore you’d rather reply on the event that explicitly tells you it’s finished.

To an Extent, you are Correct, but it works how I intend it to,

that’s where I disagree however, your post has been marked as the solution

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