how to set animation in roblox studio
To set an animation in Roblox Studio, create the animation with the Animation Editor, export it, then use the animation’s asset ID in a script to load and play it on a humanoid or rig.
Basic steps
- Open Roblox Studio and make sure you have a rig or character model to animate.
- Go to the Animation Editor and create your animation by moving body parts and adding keyframes.
- Export or publish the animation so Roblox gives it an asset ID.
- In a script, create an
Animationobject, setAnimationIdto your uploaded animation ID, and load it with the character’sAnimator.
- Play the resulting animation track when needed, such as on spawn, touch, or a button press.
Example script
lua
local humanoid = script.Parent:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://YOUR_ANIMATION_ID"
local track = animator:LoadAnimation(anim)
track:Play()
Common issues
- The animation may not play if the
AnimationIdis wrong or not owned by the account/group that owns the experience.
- The character usually needs a
Humanoidwith anAnimatorinside it for the animation to load correctly.
- If the animation seems stuck or not smooth, check keyframe timing and animation priority in the editor.
Quick note
Roblox’s official docs explain that animations are loaded through scripts, and the asset ID from the exported animation is what connects the editor work to gameplay.