TweenService

Animates properties smoothly over time.

TweenService builds Tween objects. You describe the target, the timing, and the properties to change, then play the tween and let the engine move the values.

Methods

Method Returns What it does
Create(target, info, properties) Tween Builds a tween but does not start it.

target is the instance to animate, info is a TweenInfo, and properties is a table of property names and the values to reach.

What can be tweened

Only three kinds of target animate: a Part, a Humanoid, and the SoundService. Create accepts any instance, so a tween on a Frame or a Model runs, fires Completed, and moves nothing.

On those targets, four value types are interpolated:

Value type Example
number Transparency = 1
Vector3 Position = Vector3.new(0, 10, 0)
Color3 Color = Color3.fromRGB(255, 80, 80)
CFrame CFrame = CFrame.new(0, 5, 0)

Any other value type is skipped without an error, so a property set to a boolean or an Instance simply does not move. Check that a tween changed something rather than assuming it did.

Example

local TweenService = game:GetService("TweenService")

local door = workspace:FindFirstChild("Door")
local info = TweenInfo.new(1.2, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)

local close = TweenService:Create(door, info, {
    CFrame = door.CFrame * CFrame.new(0, 0, -4),
})

close.Completed:Connect(function (state)
    print("door finished", state.Name)
end)

close:Play()

See also