Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I wait for a Tween to finish?

So I have this script:

local Tween = Gui.Intro:TweenPosition(UDim2.new(0.036,-50,0.079,-50),"Out","Quad",0.5,false)
repeat
wait()
until Tween == true

But that loops ends before the tween ends... Is there a more efficient way of doing this?

1 answer

✓ Accepted answer

Your code isn't doing what you think it's doing. GuiObject:TweenPosition() returns whether or not the tween will play.

Simply call wait() for the time the tween will take, after making the GuiObject:TweenPosition() call, rather than looping.

6 comments

0

This and another option is to supply the callback parameter but thats kinda inconvenient

0

So your saying use Tween:Wait()?

0

No, I was merely talking about calling the built-in wait() function.

0

Ohhh so just wait(0.5)?

0

Right.

0

Alright thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.