Animator

Show Deprecated

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.

Summary

Properties

Methods

Events

Properties

EvaluationThrottled

Read Only
Not Replicated
Write Parallel

PreferLodEnabled

Read Parallel

RootMotion

Read Only
Not Replicated
Not Browsable
Write Parallel

RootMotionWeight

Read Only
Not Replicated
Not Browsable
Write Parallel

Methods

ApplyJointVelocities

()

Parameters

motors: Variant

Returns

()

GetPlayingAnimationTracks


Returns

LoadAnimation

Parameters

animation: Animation

Returns

RegisterEvaluationParallelCallback

()

Parameters

callback: function

Returns

()

StepAnimations

()
Plugin Security

Parameters

deltaTime: number

Returns

()

Code Samples

Preview Animation in Studio

local RunService = game:GetService("RunService")
local function studioPreviewAnimation(model, animation)
-- find the AnimationController and Animator
local animationController = model:FindFirstChildOfClass("Humanoid")
or model:FindFirstChildOfClass("AnimationController")
local animator = animationController and animationController:FindFirstChildOfClass("Animator")
if not animationController or not animator then
return
end
-- load the Animation to create an AnimationTrack
local track = animationController:LoadAnimation(animation)
track:Play()
-- preview the animation
local startTime = tick()
while (tick() - startTime) < track.Length do
local step = RunService.Heartbeat:wait()
animator:StepAnimations(step)
end
-- stop the animation
track:Stop(0)
animator:StepAnimations(0)
-- reset the joints
for _, descendant in pairs(model:GetDescendants()) do
if descendant:IsA("Motor6D") then
local joint = descendant
joint.CurrentAngle = 0
joint.Transform = CFrame.new()
end
end
end
local character = script.Parent
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://507765644"
studioPreviewAnimation(character, animation)

Events

AnimationPlayed

Parameters

animationTrack: AnimationTrack