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

Wait until TweenSize finishes before continuing script?

Asked by 8 years ago

I read that TweenSize "Returns: bool" (http://wiki.roblox.com/index.php?title=API:Class/GuiObject/TweenSize) so after I run the function I want to wait until 'bool' is returned before continuing, but I'm not sure how to read it.

Frame:TweenSize (UDim2.new(0, 0, 0, 0), 2, 0, 4, false)
--How do I wait until the above code 'returns bool' before continuing the script?
Frame:TweenSize (UDim2.new(0.05, 0, 0.05, 0), 2, 0, 4, false)
0
As far as I know, the script doesn't continue until the tween has finished. traigla 75 — 8y
0
I wish this was true, I could provide an example if needed. If I loop tweening it stop working because functions start to run into each other. I'm tweening a lot of parts so thats why this wait is needed. magiccube3 115 — 8y

1 answer

Log in to vote
2
Answered by
ImageLabel 1541 Moderation Voter
8 years ago

The very last parameter of the TweenSize function, along with both TweenPosition and TweenSizeAndPosition can be used to pass a callback function, which executes as soon as the tweening is complete.

It essentially works like so..

function executeAfter ()
    print("Tween complete")
end

GuiObject:TweenSize(UDim2.new(), Enum.EasingDirection.In, Enum.EasingStyle.Quad, 1, false, executeAfter) -- execute after will be called whenever the tween achieves its endSize, printing "Tween complete" to the output.
Ad

Answer this question