Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

TweenSize finishing faster than its desired time?

Asked by 5 years ago

Hi there.

For some reason, when this runs, it completely skips the two seconds that the tween is supposed to be running for. it does it instantaneously. Any ideas?

mouse.Button1Down:Connect(function()
        animTrack:Play()
        stop = false
        while stop == false do
        wait()  
        for _,iore in ipairs(ore) do

            if cursorObject.Parent.Name == iore and magnitude <= 10 and hit == false and cursorObject.Parent.Health.Value > 0 then
                hitting = true
                hit = true
                local current = cursorObject.Parent.Name
                local currenthealth = replicatedstorge:WaitForChild("Health"):InvokeServer(current)

                local function executeAfter(complete)
                    print("hello")
                    replicatedstorge:WaitForChild("Mining"):FireServer(cursorObject,damage)
                    progress.Size = UDim2.new(0,0,1,0)
                    hit = false
                end

                local tween2 = progress:TweenSize(
                    UDim2.new(1,0,1,0),
                    Enum.EasingDirection.Out,
                    Enum.EasingStyle.Linear,
                    false,
                    2,
                    executeAfter
                )


            end
        end
    end 
end)

1 answer

Log in to vote
1
Answered by 5 years ago

Hello, FierceLeviathan.

Upon further examination of your code, one thing that definitely sticks out as an issue is that you put:

                local tween2 = progress:TweenSize(
                    UDim2.new(1,0,1,0),
                    Enum.EasingDirection.Out,
                    Enum.EasingStyle.Linear,
                    false,
                    2,
                    executeAfter
                )

The main issue here is that the parameters of TweenSize are endSize, easingDirection, easingStyle, time, override, and callback.

With that being said, your code should look more like this:

                local tween2 = progress:TweenSize(
                    UDim2.new(1,0,1,0),
                    Enum.EasingDirection.Out,
                    Enum.EasingStyle.Linear,
                    2,
                    false,
                    executeAfter
                )

Best of luck!

Source

0
Wow. I cannot believe I missed that. Thank you so much! FierceLeviathan 10 — 5y
0
No problem, friend. Rocketerkid 237 — 5y
0
Hey! Another thing, how would I go as to stop the tween when mouse.button1up occurs? Thanks again! FierceLeviathan 10 — 5y
Ad

Answer this question