Class · inherits Instance
Animator
Responsible for the playback and replication of Animations.
About Animator
Animator is the main class responsible for the playback and replication of
Animations. All replication of playing
AnimationTracks is handled through the Animator
instance.
See Animation in Roblox to learn how to create and add pre-built or custom animations to your game.
Properties 2
EvaluationThrottled
: booleanReadOnlyNotReplicatedIndicates whether animation evaluation was throttled (skipped) this frame for thisAnimator.A read-only property that indicates whether animation evaluation was throttled (skipped) on this frame. When
true, theAnimatorreused the pose from the previous frame instead of evaluating fresh animation data.This property is useful when layering procedural animation on top of
Transform— if evaluation was throttled, applying procedural offsets would fight the stale pose and should be skipped:PreferLodEnabled
: booleanControls whether animation LOD throttling is allowed for thisAnimator. When set tofalse, animations always evaluate at full fidelity.When
true(the default), the engine may reduce animation evaluation frequency for remotely-simulated characters based on distance, screen coverage, and frame budget. When set tofalse, LOD-based throttling is disabled and thisAnimatoralways evaluates at full fidelity.Setting this to
falseis useful for important NPCs or characters that must always animate smoothly regardless of distance. However, disabling LOD for many animators simultaneously can impact performance.Note that this property only controls per-animator LOD throttling. The workspace-level
Workspace.ClientAnimatorThrottlingModesetting can independently disable or enable throttling for all animators.
Methods 5
ApplyJointVelocities
(motors: Variant) → ()Computes relative velocities between parts and applies them toMotor6D.Part1.Given the current set of
AnimationTracksplaying and their current times and play speeds, this method computes relative velocities between the parts and applies them toMotor6D.Part1(the part whichAnimatorconsiders 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.
Note that 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
Motor6Dsare not required to be descendants of theDataModel. Removing the joints from theDataModelbefore calling this method is supported.GetPlayingAnimationTracks
() → ArrayReturns the list of currently activeAnimationTracks.Returns the list of currently active
AnimationTrackson thisAnimator. This includes tracks that are fading out and does not depend onAnimationTrack.IsPlayingbeingtrue; as a result,GetTrackByAnimationId()may be a better option to get a specificAnimationTrackby its asset ID. Fading tracks are automatically stopped and removed from this list once their blend weight reaches zero.GetTrackByAnimationId
(animationId: ContentId) → AnimationTrack?Returns an existingAnimationTrackon thisAnimatorthat was loaded from anAnimationwith the given animation ID. UnlikeLoadAnimation(), this method does not create a newAnimationTrackinstance.Returns an existing
AnimationTrackon thisAnimatorthat was loaded from anAnimationwith the given animation ID. UnlikeLoadAnimation(), this method does not create a newAnimationTrackinstance; it only looks up a track that was previously loaded.If multiple tracks have been loaded for the same animation ID, this method returns the first match. If no matching track exists, it returns
nil.LoadAnimation
(animation: Animation) → AnimationTrackLoads anAnimationonto anAnimator, returning anAnimationTrack.This method loads the given
Animationonto thisAnimator, returning a playableAnimationTrack. When called on anAnimatorwithin models that the client has network ownership of, for example the local player's character or fromBasePart.SetNetworkOwner, this method also loads the animation for the server as well.Note that the
Animatormust be in theWorkspacebefore making a call toLoadAnimation()or else it will be unable to retrieve theAnimationClipProviderservice and throw an error.Warning
Do not use
LoadAnimation()in an attempt to retrieve an existing track. CallingLoadAnimation()always creates a newAnimationTrackinstance which may impact game performance if overused. Instead, useGetTrackByAnimationId()when you need to look up a track that was already loaded.Loading an Animation on Client or Server
In order for
AnimationTracksto replicate correctly, it's important to know when they should be loaded on the client or on the server:If an
Animatoris a descendant of aHumanoidorAnimationControllerin a player'sPlayer.Character, animations started on that player's client will be replicated to the server and other clients.If the
Animatoris not a descendant of a player character, its animations must be loaded and started on the server to replicate.
The
Animatorobject must be initially created on the server and replicated to clients for animation replication to work at all. If anAnimatoris created locally, thenAnimationTracksloaded with thatAnimatorwill not replicate.StepAnimations
(deltaTime: float) → ()Increments theAnimationTrack.TimePositionof all playingAnimationTracksthat are loaded onto theAnimator, applying the offsets to the model associated with theAnimator. For use in the command bar or by plugins only.Increments the
AnimationTrack.TimePositionof all playingAnimationTracksthat are loaded onto theAnimator, applying the offsets to the model associated with theAnimator. For use in the command bar or by plugins only.The
deltaTimeparameter determines the number of seconds to increment on the animation's progress. Typically this method 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).
Access
This method requires Plugin-level security. It can only be called from the Studio command bar or from a
Plugin. RegularScriptandLocalScriptinstances cannot call this method.
Events 1
AnimationPlayed
Animator.AnimationPlayed:Connect(function(animationTrack))Fires when theAnimatorstarts playing anAnimationTrack.Fires for all
AnimationTrack.Playcalls onAnimationTrackscreated and owned by theAnimator.
Animator 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.