Skip to content

Tween

System · Tween · server and client scripts

Tween animates entity or world properties from their current values to target values over time.

Play

Property
Play: TweenPlayFn

Play animates a component or field handle on e to to over seconds and returns a Tween handle.

Example

-- Server script.
local platform = World.Spawn({
    Shape = "Box",
    Position = Vector3.new(0, 10, 0),
})

local tween = Tween.Play(platform, Component.Position, Vector3.new(20, 10, 0), 3, {
    Transition = "Sine",
})
tween.Finished:Connect(function()
    print("arrived")
end)

Create

Function
Create(e: Entity | WorldType, seconds: number, options: TweenOptions?) -> TweenBuilder

Create returns a TweenBuilder for animating several properties together over seconds before calling :Play().

Example

-- Server script.
local platform = World.Spawn({
    Shape = "Box",
    Position = Vector3.new(0, 10, 0),
})

local handle = Tween.Create(platform, 2)
    :To(Component.Position, Vector3.new(20, 10, 0))
    :Play()
handle:Pause()