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
game:GetService("RunService").Heartbeat:Connect(function()
T:Create(game.Lighting, TweenInfo.new(
math.clamp(Time, 1, 10), -- Me randomly playing with math LOL
EasingStyle,
EasingDirection,
--math.huge Useless
),
{ClockTime = 48}):Play()
if game.Lighting.ClockTime == 0 then
game.Lighting.ClockTime = 23.999
end
end)
end
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, TweenInfo.new(24, Enum.EasingStyle.Linear, Enum.EasingDirection.In,0,false,0), {ClockTime = 23.99})
--PHASE 2, Connect RBXScriptSignal (Event) to function
Tween.Completed:Connect(function()
game.Lighting.ClockTime = 0
Tween:Play() --Loop
end)
--EXECUTION
Tween:Play() --Launch Phase 1
This method helps you be 100% sure your tween is finished and will not fail on you.
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, TweenInfo.new(Time,EasingStyle,Enum.EasingDirection.InOut),{ClockTime = 23.999})
local B = T:Create(game.Lighting, TweenInfo.new(Time,EasingStyle,Enum.EasingDirection.InOut),{ClockTime = 11.999})
A.Completed:Connect(function()
game.Lighting.ClockTime = 0
B:Play()
end)
B.Completed:Connect(function()
A:Play()
end)
A:Play()
end
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.