Oncomplate

Constructor:

Oncomplate(callback)

Description

Triggers an event when the Tween animation finishes playing.

Parameter

Variable name Class Name Description
callback fuction The function to call.

Examples

Use the following code. It can be added to a server or client script. The code is to create a part and an animation for the part to play. Play the animation after creating a Tweener object, and output a text when the animation finishes playing.

local part = RWObject.Create("Part")
part.Name = "RE"
part.Parent = WorkSpace
local tweenInfo = 
{
    duration = 3000, -- unit: ms
    repeatCount = 1, -- repeat times, -1 for no limit
    easing = "inSine", -- animation playing type
    yoyo = true, -- animation loop type
    delay = 1000 -- delay for repeated playing
}

local action = {
    Position = Vector3.New(20, 0, 20), 
    Rotation = Vector3.New(0, 90, 0), 
    Color = Vector3.New(0, 255, 0)
    }
local tween = TweenServiceJS:CreateTween(part, tweenInfo,action)
tween:OnComplete(function()
        print("Playing finished")
end)
tween:Play()