Reference API Roblox

Engine API

Website

Related

Reference API Roblox

Animator

Responsible for the playback and replication of Animations.

Member index 24

HistoryMember
566EvaluationThrottled: bool
553PreferLodEnabled: bool
596RootMotion: CFrame
596RootMotionWeight: float
573ApplyJointVelocities(motors: Variant): null
462GetPlayingAnimationTracks(): Array
540GetPlayingAnimationTracksCoreScript(): Array
486LoadAnimation(animation: Animation): AnimationTrack
540LoadAnimationCoreScript(animation: Animation): AnimationTrack
528LoadStreamAnimation(animation: TrackerStreamAnimation): AnimationStreamTrack
569LoadStreamAnimationForSelfieView_deprecated(animation: TrackerStreamAnimation, player: Player): AnimationStreamTrack
637LoadStreamAnimationV2(animation: TrackerStreamAnimation, player: Player = Player, shouldLookupPlayer: bool = true, shouldReplicate: bool = true): AnimationStreamTrack
591RegisterEvaluationParallelCallback(callback: Function): null
573StepAnimations(deltaTime: float): null
607SynchronizeWith(otherAnimator: Animator): null
486AnimationPlayed(animationTrack: AnimationTrack)
540AnimationPlayedCoreScript(animationTrack: AnimationTrack)
551AnimationStreamTrackPlayed(animationTrack: AnimationStreamTrack)
inherited from Instance
553Archivable: bool
635Capabilities: SecurityCapabilities
553Name: string
553Parent: Instance
635Sandboxed: bool
616UniqueId: UniqueId
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
648GetChildren(): Instances
462GetDebugId(scopeLength: int = 4): string
486GetDescendants(): Array
486GetFullName(): string
641GetStyled(name: string): Variant
576GetTags(): Array
576HasTag(tag: 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
648children(): Instances
553clone(): Instance
573destroy(): null
553findFirstChild(name: string, recursive: bool = false): Instance
648getChildren(): Instances
553isDescendantOf(ancestor: Instance): bool
573remove(): null
462AncestryChanged(child: Instance, parent: Instance)
462AttributeChanged(attribute: string)
462ChildAdded(child: Instance)
462ChildRemoved(child: Instance)
462DescendantAdded(descendant: Instance)
462DescendantRemoving(descendant: Instance)
500Destroying()
553childAdded(child: Instance)
inherited from Object
647ClassName: string
647className: string
647GetPropertyChangedSignal(property: string): RBXScriptSignal
647IsA(className: string): bool
650isA(className: string): bool
647Changed(property: string)

Description

The main class responsible for the playback and replication of Animations. All replication of playing AnimationTracks is handled through the Animator instance.

See also Animation Editor and Using Animations to learn how to create and add pre-built or custom animations to your game.

History 38

Members 24

AnimationPlayed

Parameters (1)
animationTrackAnimationTrack

Fires for all AnimationTrack:Play() calls on AnimationTracks created and owned by the Animator.

History 3

AnimationPlayedCoreScript

Parameters (1)
animationTrackAnimationTrack

History 1

AnimationStreamTrackPlayed

Parameters (1)
animationTrackAnimationStreamTrack

History 1

ApplyJointVelocities

Parameters (1)
motorsVariant
Returns (1)
null

Given the current set of AnimationTracks playing, and their current times and play speeds, compute relative velocities between the parts and apply them to Motor6D.Part1 (the part which Animator considers the "child" part). These relative velocity calculations and assignments happen in the order provided.

This method doesn't apply velocities for a given joint if both of the joint's parts are currently part of the same assembly, for example, if they are still connected directly or indirectly by Motors or Welds.

This method doesn't disable or remove the joints for you. You must disable or otherwise remove the rigid joints from the assembly before calling this method.

The given Motor6Ds are not required to be descendants of the DataModel. Removing the joints from the DataModel before calling this method is supported.

History 3

EvaluationThrottled

TypeDefault
boolfalse
This property is not replicated. Its interface does not cross the network boundary.
This property is read-only. Its value can be read, but it cannot be modified.
This property is not browsable. It is not visible in Studio's object browser.

History 1

Tags: [ReadOnly, NotReplicated, NotBrowsable]

GetPlayingAnimationTracks

Parameters (0)
No parameters.
Returns (1)
Array

Returns the list of currently playing AnimationTracks.

History 2

GetPlayingAnimationTracksCoreScript

Parameters (0)
No parameters.
Returns (1)
Array

History 1

LoadAnimation

Parameters (1)
animationAnimation
Returns (1)
AnimationTrack

This function loads the given Animation onto this Animator, returning a playable AnimationTrack. When called on an Animator within models that the client has network ownership of, for example the local player's character or from BasePart:SetNetworkOwner(), this function also loads the animation for the server as well.

You should use this function directly instead of the similarly-named Humanoid:LoadAnimation() and AnimationController:LoadAnimation() functions. These are deprecated proxies of this function which also create an Animator if one does not exist; this can cause replication issues if you are not careful.

Loading an Animation on Client or Server

In order for AnimationTracks to replicate correctly, it's important to know when they should be loaded on the client or on the server:

  • If an Animator is a descendant of a Humanoid or AnimationController in a player's Player.Character, animations started on that player's client will be replicated to the server and other clients.

  • If the Animator is not a descendant of a player character, its animations must be loaded and started on the server to replicate.

The Animator object must be initially created on the server and replicated to clients for animation replication to work at all. If an Animator is created locally, then AnimationTracks loaded with that Animator will not replicate.

History 4

LoadAnimationCoreScript

Parameters (1)
animationAnimation
Returns (1)
AnimationTrack

History 1

LoadStreamAnimation

Parameters (1)
animationTrackerStreamAnimation
Returns (1)
AnimationStreamTrack

History 1

LoadStreamAnimationForSelfieView_deprecated

Parameters (2)
animationTrackerStreamAnimation
playerPlayer
Returns (1)
AnimationStreamTrack

History 1

LoadStreamAnimationV2

Parameters (4)Default
animationTrackerStreamAnimation
playerPlayerPlayer
shouldLookupPlayerbooltrue
shouldReplicatebooltrue
Returns (1)
AnimationStreamTrack

History 1

PreferLodEnabled

TypeDefault
booltrue

History 2

RegisterEvaluationParallelCallback

Parameters (1)
callbackFunction
Returns (1)
null

History 1

RootMotion

TypeDefault
CFrame
This property is not replicated. Its interface does not cross the network boundary.
This property is read-only. Its value can be read, but it cannot be modified.
This property is not browsable. It is not visible in Studio's object browser.

History 1

Tags: [ReadOnly, NotReplicated, NotBrowsable]

RootMotionWeight

TypeDefault
float0
This property is not replicated. Its interface does not cross the network boundary.
This property is read-only. Its value can be read, but it cannot be modified.
This property is not browsable. It is not visible in Studio's object browser.

History 1

Tags: [ReadOnly, NotReplicated, NotBrowsable]

StepAnimations

Parameters (1)
deltaTimefloat
Returns (1)
null

Increments the AnimationTrack.TimePosition of all playing AnimationTracks that are loaded onto the Animator, applying the offsets to the model associated with the Animator. For use in the command bar or by plugins only.

The deltaTime parameter determines the number of seconds to increment on the animation's progress. Typically this function will be called in a loop to preview the length of an animation (see example).

Note that once animations have stopped playing, the model's joints will need to be manually reset to their original positions (see example).

This function is used to simulate playback of Animations when the game isn't running. This allows animations to be previewed without the consequences of running the game, such as scripts executing. If the function is called while the game is running, or by Scripts or LocalScripts, it will return an error.

Developers designing their own custom animation editors are advised to use this function to preview animations, as it is the method the official Roblox Animation Editor plugin uses.

History 3

SynchronizeWith

Parameters (1)
otherAnimatorAnimator
Returns (1)
null

History 1

Settings