API:Class/TweenService

Filtered-inheritance mode: While this class technically inherits all Instance class members, some (if not all) have been hidden because they serve no purpose for this object.
Service: This class is a service. It is a top-level singleton which can be obtained with the GetService method.

Tween.pngTweenService : Object Icon.pngInstance

Tweens are used to interpolate the properties of instances. These can be used to create animations for various Roblox objects. While positions of parts are most often used for tweens (to animate a part moving), almost any numeric property can be tweened using TweenService. Note that only specific types of properties can be used with TweenService. The types of properties that can be tweened are:

TweenService itself is used to create Tweens, Tweens being the playback object for the animation. TweenService has just one function, Create, which takes information about the animation and generates the Tween object which can be used to play the animation. Note that tweens can animate multiple properties at the same time.

Functions

Functions [toggle]

TweenCreate ( Instance instance, TweenInfo tweenInfo, dictionary propertyTable )

Creates a Tween that is used to handle playback of interpolation on the specified object.

|RMD member="API:Class/TweenService/Create"|Creates a Tween that is used to handle playback of interpolation on the specified object.|/RMD|
Create ( Instance instance, TweenInfo tweenInfo, dictionary propertyTable )
Creates a Tween that is used to handle playback of interpolation on the specified object.


|RMD member="API:Class/TweenService"|Tweens are used to interpolate the properties of instances. These can be used to create animations for various Roblox objects. While positions of parts are most often used for tweens (to animate a part moving), almost any numeric property can be tweened using TweenService. Note that only specific types of properties can be used with TweenService. The types of properties that can be tweened are: * number * bool * CFrame * Rect * Color3 * UDim * UDim2 * Vector2 * Vector2int16 * Vector3 TweenService itself is used to create Tweens, Tweens being the playback object for the animation. TweenService has just one function, Create, which takes information about the animation and generates the Tween object which can be used to play the animation. Note that tweens can animate multiple properties at the same time. |/RMD|


Example

In this example a Tween is created to animate the position and color of a Part. Because the position and color are part of the same tween, they will change at the exact same rate and will reach their goal at the same time.

local TweenService = game:GetService("TweenService")
 
local part = Instance.new("Part")
part.Position = Vector3.new(0, 10, 0)
part.Color = Color3.new(1, 0, 0)
part.Anchored = true
part.Parent = game.Workspace
 
local goal = {}
goal.Position = Vector3.new(10, 10, 0)
goal.Color = Color3.new(0, 1, 0)
 
local tweenInfo = TweenInfo.new(5)
 
local tween = TweenService:Create(part, tweenInfo, goal)
 
tween:Play()