So when i made a tween for a bar to simply increase the size of X, i also added a line so when it reaches the end, it should go back to 0 size, but it doesn't
Here is the script:
local Event = game:GetService("ReplicatedStorage").ClientEvents:WaitForChild("AtomStartProgress") local Tween_Service = game:GetService("TweenService") local Fill_Time = 1 local Tween_Information = TweenInfo.new(Fill_Time,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0) local Tween_Targerts = { Size = UDim2.new(0,250, 0,35), Position = UDim2.new(0.321, 0, 0.22, 0) } local Fill_Tween = Tween_Service:Create(script.Parent,Tween_Information,Tween_Targerts) wait(0.4) Event.Event:Connect(function() Fill_Tween:Play() wait() script.Parent.Size = UDim2.new(0,1, 0,35) end)
You didn't give time and did wait(). The tween is longer and so after it plays (without finishing) it goes to the next code and it does
script.Parent.Size = UDim2.new(0,1, 0,35)
but the tween is still going so it changes the size (by the tween) and finishes the code.
So you can do wait() longer like wait(1.5)
Event.Event:Connect(function() Fill_Tween:Play() wait(1.5) script.Parent.Size = UDim2.new(0,1, 0,35) end)