Load and play AnimationTracks so your characters run, jump, attack, and emote — not just stand around.
A character that can only walk looks unfinished. Animations give characters personality — a running cycle, a jump, an attack swing. They're the difference between a moving puppet and a believable .
Animations live in Roblox's asset library. To play one, you load it onto the Humanoid:
local humanoid = character:WaitForChild("Humanoid")
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://123456789" -- a real animation ID
local track = humanoid:LoadAnimation(animation)
track:Play()
Animation — an object that points to a published animation asset via AnimationId.:LoadAnimation() — returns an AnimationTrack you can play, stop, and tweak.:Play() — starts it immediately.The animation must be uploaded to Roblox (via the Animation Editor in Studio or the website) and its ID pasted into AnimationId. A placeholder number won't play anything.
The method on Humanoid that loads an Animation and returns an AnimationTrack is .
AnimationTracks have full playback control:
track:Play() -- start from the beginning
track:Stop() -- stop immediately
track:Play(0.5, 1.0, 2.0) -- fade in over 0.5s, full speed, stop after 2s
The three arguments to :Play() are fadeInTime, weight, and speed. The most common use is track:Play() with defaults — fade and weight are rarely needed for basic playback.
A character just spawned. Load the idle animation (rbxassetid://111) and play it immediately.
local humanoid = character:WaitForChild("Humanoid")
-- create, load, and play the idle animationControl how the animation plays:
track:AdjustSpeed(1.5) -- 1.5x speed — faster run
track:AdjustSpeed(0.5) -- half speed — slow motion
track.Looped = true -- loop forever (set before Play)
Looped = true makes the animation repeat — perfect for idle, walk, and run cycles. One-shot animations like attacks or dances should stay Looped = false.
How do you make a walk animation play at double speed?
AnimationTracks fire you can connect to:
track.Stopped:Connect(function()
print("Animation finished")
end)
track:GetMarkerReachedSignal("HitFrame"):Connect(function()
-- damage the enemy at the exact right moment
end)
Stopped fires when the animation ends (or is stopped). GetMarkerReachedSignal fires when the animation reaches a named marker in the Animation Editor — useful for syncing damage, footsteps, or effects to specific frames.
Markers are set in the Animation Editor in Studio. They're the most precise way to time gameplay to an animation.
rbxassetid://1234 plays nothing. Upload the animation in Studio's Animation Editor and copy the real asset ID.Humanoid:LoadAnimation on the server with replication.Next: building the world itself from — .