Skip to content

Service · inherits Instance

TweenService

Official docs ↗

Used to create Tweens which interpolate, or tween, the properties of instances.

About TweenService

TweenService is used to create Tweens which interpolate, or tween, the properties of instances. Tweens can be used on any object with compatible property types, including:

TweenService.Create, the primary constructor function, takes TweenInfo specifications about the tween and generates the Tween object which can then be used to play the tween.

Note that Tweens can interpolate multiple properties at the same time, but they must not be interpolating the same property. If two tweens attempt to modify the same property, the initial tween will be cancelled and overwritten by the most recent tween.

Methods 3

  • Create(instance: Instance, tweenInfo: TweenInfo, propertyTable: Dictionary) → TweenCreates a new Tween given the object whose properties are to be tweened, a TweenInfo, and a dictionary of goal property values.

    This constructor creates a new Tween from three arguments: the object to tween, the TweenInfo specifications, and a table containing the properties to tween and values to tween to.

    The propertyTable parameter needs to be a dictionary where the keys are the string names of the property (for example Position, Transparency, or Color), and the values are the property targets at the end of the tween.

    The Tween created using this function is unique to the object given as the instance parameter. To apply the same tween to another object, call this function again with the new object.

  • GetValue(alpha: float, easingStyle: EasingStyle, easingDirection: EasingDirection) → floatCalculates a new alpha given an EasingStyle and EasingDirection.

    Returns a new alpha value for interpolating using the given alpha value, EasingStyle, and EasingDirection. The provided alpha value will be clamped between 0 and 1.

  • SmoothDamp(current: Variant, target: Variant, velocity: Variant, smoothTime: float, maxSpeed: float?, dt: float?) → TupleSmoothly interpolates a value towards a target, simulating a critically damped spring.

    Smoothly interpolates a value towards a target, simulating a critically damped spring. Returns a tuple with (newValue, newVelocity). newVelocity needs to be fed to the next call of SmoothDamp to ensure smooth results. Supports number, Vector2, Vector3, and CFrame.

TweenService also has every member of Instance. Deprecated and Roblox-only members are hidden.

Reference text from the Roblox Creator Documentation, licensed CC BY 4.0, reorganized by rbxtoolshub.com · Studio 0.743.0.7431133.