Reference API Roblox

Engine API

Website

Related

Reference API Roblox

TweenService

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

This class is not creatable. Instances of this class cannot be created with Instance.new.
This class is a service. It is a singleton that may be acquired with GetService.
Tags: [NotCreatable, Service]

Member index 3

HistoryMember
498Create(instance: Instance, tweenInfo: TweenInfo, propertyTable: Dictionary): Tween
462GetValue(alpha: float, easingStyle: EasingStyle, easingDirection: EasingDirection): float
636SmoothDamp(current: Variant, target: Variant, velocity: Variant, smoothTime: float, maxSpeed: float?, dt: float?): (Variant, Variant)
inherited from Instance
553Archivable: bool
635Capabilities: SecurityCapabilities
553ClassName: string
553Name: string
553Parent: Instance
635Sandboxed: bool
616UniqueId: UniqueId
553className: string
576AddTag(tag: string): null
573ClearAllChildren(): null
462Clone(): Instance
573Destroy(): null
486FindFirstAncestor(name: string): Instance
486FindFirstAncestorOfClass(className: string): Instance
486FindFirstAncestorWhichIsA(className: string): Instance
486FindFirstChild(name: string, recursive: bool = false): Instance
486FindFirstChildOfClass(className: string): Instance
486FindFirstChildWhichIsA(className: string, recursive: bool = false): Instance
486FindFirstDescendant(name: string): Instance
563GetActor(): Actor
486GetAttribute(attribute: string): Variant
462GetAttributeChangedSignal(attribute: string): RBXScriptSignal
631GetAttributes(): Dictionary
486GetChildren(): Objects
462GetDebugId(scopeLength: int = 4): string
486GetDescendants(): Array
486GetFullName(): string
462GetPropertyChangedSignal(property: string): RBXScriptSignal
641GetStyled(name: string): Variant
576GetTags(): Array
576HasTag(tag: string): bool
486IsA(className: string): bool
486IsAncestorOf(descendant: Instance): bool
486IsDescendantOf(ancestor: Instance): bool
580IsPropertyModified(name: string): bool
573Remove(): null
576RemoveTag(tag: string): null
580ResetPropertyToDefault(name: string): null
573SetAttribute(attribute: string, value: Variant): null
462WaitForChild(childName: string, timeOut: double): Instance
553children(): Objects
553clone(): Instance
573destroy(): null
553findFirstChild(name: string, recursive: bool = false): Instance
553getChildren(): Objects
462isA(className: string): bool
553isDescendantOf(ancestor: Instance): bool
573remove(): null
462AncestryChanged(child: Instance, parent: Instance)
462AttributeChanged(attribute: string)
462Changed(property: string)
462ChildAdded(child: Instance)
462ChildRemoved(child: Instance)
462DescendantAdded(descendant: Instance)
462DescendantRemoving(descendant: Instance)
500Destroying()
553childAdded(child: Instance)

Description

Tweens are used to interpolate the properties of instances. These can be used to create animations for various Roblox objects. 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's constructor function, TweenService:Create(), 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.

Details on how the interpolation of the tween is to be carried out are given in the tweenInfo parameter of TweenService:Create(). The TweenInfo data type includes a range of properties that can be used to achieve various styles of animation, including reversing and looping Tweens (see examples).

Multiple tweens can be played on the same object at the same time, but they must not be animating 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 (see examples).

Although other methods exist for tweening objects, such as GuiObject:TweenSizeAndPosition(), TweenService allows multiple properties to be modified and for the animation to be paused and cancelled at any point.

History 7

Members 3

Create

Parameters (3)
instanceInstance
tweenInfoTweenInfo
propertyTableDictionary
Returns (1)
Tween

The Create function of TweenService creates a new Tween. The function takes three arguments: the object to tween, the TweenInfo to use, and a table containing the properties to tween and the values to tween to.

Tweens are used to interpolate the properties of instances. These can be used to create animations for various Roblox objects. Almost any numeric property can be tweened using TweenService.

The propertyTable parameter that is passed in needs to be a dictionary where the keys are the string names of the property (e.g. "Position", "Transparency", "Color", etc), and the value is the value the property needs to be at the end of the tween. Note that only specific types of properties can be used with TweenService, but multiple properties can be animated in the same tween. The types of properties that can be tweened are:

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.

Details on how the interpolation of the tween is to be carried out are given in the TweenInfo parameter, such as reversing, looping and easing.

History 3

GetValue

Parameters (3)
alphafloat
easingStyleEasingStyle
easingDirectionEasingDirection
Returns (1)
float

Returns a new alpha value for interpolating using the given alpha value, EasingStyle, and EasingDirection.

The provided alpha value is clamped between 0 and 1.

History 2

SmoothDamp

Parameters (6)
currentVariant
targetVariant
velocityVariant
smoothTimefloat
maxSpeedfloat?
dtfloat?
Returns (2)
Variant
Variant

History 1

Settings