Problems with tweening

So I have this piece of code (its just a part of the total script):

...
Timeleft = script.Parent

function tween(PauseTween)
    local gui = Timeleft
    local colorgui = FuelGui.Frame.TimeLeft
    local speed = 10
    local Tween = TweenService:Create(gui, TweenInfo.new(speed, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {Size = UDim2.new(0, 18, 0, 0)})
    local ColorTween = TweenService:Create(colorgui, TweenInfo.new(speed, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {BackgroundColor3 = Color3.fromRGB(175, 11, 0)})
    local playbackChanged = Tween.PlaybackState
    local playbackChanged2 = ColorTween.PlaybackState
    ColorTween:Play()
    Tween:Play()
    if Tool.Fire.Value ~= true then
        ColorTween:Pause()
        Tween:Pause()
        wait(0.1)
    end
end
function FuelDrain()
    if Tool.Fire.Value == true then
           local gui = Timeleft        
        while fuel ~= 0 or Tool.Fire.Value == false do
            print(fuel)
            fuel = gui.AbsoluteSize.Y
            wait(0.09)
        end
    end
    if fuel <= 0 then
        Tool.Fire.Value = false
        PutOutFire()
        EmptyFuel.Notification:Play()
        EmptyFuel.TextTransparency = 0
        wait(6)
        EmptyFuel.TextTransparency = 1
        
    end
end

...

It works all fine… but when I pause the tween, the tween starts to play slower and slower the more it gets to the end, the more I pause the tween. Does the tween reset? But I am just pausing it and nothing more.

As clarification, so when I pause the tween at the start and play it again, the print(fuel) doesn’t print duplicate values. But the more and more I pause the tween later on, the more print(fuel) outputs are duplicated or even multiplicated.

1 Like