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

How would I know when a tween is finished playing?

Asked by 5 years ago

Is there a certain function for this, or do I just make a loop and check when it has reached the position in vector3 value?

1
There is an event for a Tween object called "Completed". This should be what you need. Also, do you have a script so we can take a look at how you tried to do this? starlebVerse 685 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

The Tween class possesses an event called Completed that does exactly what you would expect it to. A couple applications:

If you want something to happen every time any tween finishes (useful for multiple tweens or reusing the same tween instance):

local function on_tween()
    -- Code
end

tween.Completed:Connect(on_tween)

If you want to wait for a tween to finish playing before continuing script execution:

tween.Completed:wait()
Ad

Answer this question