Tween

Tween : TweenBase

Properties

Instance

Instance

Read-only property that points to the Instance whose properties are being interpolated by the tween.

Code Samples

TweenInfo

TweenInfo

The TweenInfo property defines the duration, easing style, easing direction, repeat count, reverses, and delay time for the Tween animation. It is essential for customizing the characteristics of the animation.

Code Samples

local TweenService = game:GetService("TweenService")
local Part = workspace:WaitForChild("Part") 

-- Setting Tween information
local TweenInfoData = TweenInfo.new(
    5,                         -- Time               
    Enum.EasingStyle.Linear,   -- EasingStyle
    Enum.EasingDirection.Out,  -- EasingDirection
    0,                         -- RepeatCount     
    false,                     -- Reverses
    0                          -- DelayTime
)

-- Properties to be changed with the tween
local TweenGoals = 
{
    Position = Vector3.new(-400, 50, -350)
}

local Tween = TweenService:Create(Part, TweenInfoData, TweenGoals)
Tween:Play()

Methods

Play

The Play method starts or resumes the Tween animation, allowing the object’s properties to transition smoothly toward the defined goals.

Parameters

Return

void

Code Samples

Tween:Play()

Cancel

The Cancel method stops the Tween animation immediately and resets the properties to their initial state.

Parameters

Return

void

Code Samples

Tween:Cancel()

Pause

The Pause method temporarily halts the Tween animation, allowing it to be resumed later without resetting.

Parameters

Return

void

Code Samples

Tween:Pause() -- Pause
wait(2)

Tween:Play()  -- Resume

Events

Last updated