Roblox Studio error

Failed to load animation with sanitized ID

What Failed to load animation with sanitized ID means in Roblox Studio, the three things that cause it with the code that triggers each, and the fix for each one.

Updated 23 October 20263 min readErrorLuau

In short

Roblox refused to load the animation with that ID in this experience. Almost always it is an ownership problem: the animation belongs to another account (from a free model or a tutorial), or the game belongs to a group while the animation was uploaded to your personal account. Upload the animation from the account or group that owns the experience (or have its owner share it with that experience) and use the new ID. Also check the ID is written as rbxassetid:// followed by the number.

  • Group game: the animation must be uploaded to the same group, or shared with it.
  • Your own game: animations you uploaded yourself work; animations from other creators usually do not.
On this page
  1. What it means
  2. Causes and fixes
  3. Fix it with RoCode
  4. Find the line
  5. Questions
  6. Sources

What the message means

Output (example)
Failed to load animation with sanitized ID rbxassetid://1234567890: AnimationClip loaded is not valid.

Other forms of the same message:

  • Failed to load animation - sanitized ID: rbxassetid://1234567890

"Sanitized" means Roblox checked the ID and removed it because this experience is not allowed to use it. The script did nothing wrong; the asset is just not available to this game.

Roblox now lets animation owners share an animation with other creators and groups, who can then use it in their experiences. Without that, an animation only plays in experiences owned by the same user or group that uploaded it.

Causes and fixes

Three things cause this error in practice. Each one below has the smallest code that triggers it, then the fix.

The animation belongs to someone else

IDs copied from a free model, a YouTube tutorial or a friend's game point at an animation another account owns. It may even have played for them, because they own it.

Breaks LocalScript in StarterCharacterScripts named Wave
local Players = game:GetService("Players")

local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")

local wave = Instance.new("Animation")
wave.AnimationId = "rbxassetid://1234567890" -- someone else's upload
humanoid:LoadAnimation(wave):Play()

Open the animation in the Animation Editor, publish it from your own account (or the group that owns the game), and use the new ID it gives you. Load it through the Animator.

Fixed LocalScript in StarterCharacterScripts named Wave
local Players = game:GetService("Players")

-- the ID you got when you published the animation yourself
local WAVE_ID = "rbxassetid://1234567890"

local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid") :: Humanoid
local animator = humanoid:WaitForChild("Animator") :: Animator

local wave = Instance.new("Animation")
wave.AnimationId = WAVE_ID
local track = animator:LoadAnimation(wave)
track:Play()

Replace the number with your own animation ID.

A group game uses an animation from a personal account

The game is owned by a group, but the animation was published to your own profile. It can work for you in Studio and fail for everyone in the live game, because the experience's owner (the group) does not own it.

Breaks Script in ServerScriptService named GuardIdle
-- the experience is owned by a group;
-- this animation was published to a personal account
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://1234567890"

local npc = workspace:WaitForChild("Guard")
local humanoid = npc:WaitForChild("Humanoid")
humanoid:LoadAnimation(animation):Play()

Publish the animation again with the group as the creator (the Animation Editor asks who to publish as), and use that ID. Or share the personal animation with the group.

Fixed Script in ServerScriptService named GuardIdle
-- published with the group as creator
local GUARD_IDLE_ID = "rbxassetid://1234567890"

local npc = workspace:WaitForChild("Guard")
local humanoid = npc:WaitForChild("Humanoid") :: Humanoid
local animator = humanoid:FindFirstChildOfClass("Animator") or Instance.new("Animator", humanoid)

local animation = Instance.new("Animation")
animation.AnimationId = GUARD_IDLE_ID
animator:LoadAnimation(animation):Play()

The ID is in the wrong format

Pasting the Creator Store page link instead of the asset ID gives Roblox an ID it cannot use.

Breaks Script in ServerScriptService named Wave
local animation = Instance.new("Animation")
-- a web page link, not an asset ID
animation.AnimationId = "https://create.roblox.com/store/asset/1234567890/Wave"
print(animation.AnimationId)

Use rbxassetid:// followed by the number only.

Fixed Script in ServerScriptService named Wave
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://1234567890"
print(animation.AnimationId)

Fix it in your place

Paste the error, RoCode fixes it in your place

Copy the line from Output and paste it here. RoCode opens the script it names in the place you have open in Studio, works out which of the causes above it is, and edits the code there instead of handing you a snippet to paste.

For example: Failed to load animation with sanitized ID rbxassetid://1234567890: AnimationClip loaded is not valid.

RoCode is an AI agent for Roblox Studio: it reads the scripts in the place you have open, finds the line and edits it there, and every change is an undo point. It runs on Windows or macOS with a desktop browser. Free to start, with free credits every day.

How to find the line that causes it

  1. The message gives the animation ID. Search your scripts and the Explorer for that number with Ctrl+Shift+F; it is usually in an Animation object's AnimationId or a script that sets one.
  2. Check who owns the animation: open the ID on the Creator Hub, or look under your (or your group's) Animations in the Creator Hub.
  3. Then check who owns the experience: your account or a group. The two must match, or the animation must be shared with the experience's owner.

Questions

What does sanitized ID mean?

Roblox removed the ID because this experience is not allowed to load that animation, usually because a different user or group owns it.

Why does the animation work in Studio but not in the game?

In Studio it may load because you own it. In a live game owned by a group, the group must own the animation, or have it shared with it.

Can I use animations from the Creator Store?

Animations made by Roblox work everywhere. Animations made by other creators generally only work in their own experiences unless they share them with you.

Can RoCode fix it?

RoCode can fix the script side: the ID format and loading through the Animator. Uploading the animation to the right account or group is something you do in Studio's Animation Editor.

Sources and further reading

How the code was checked: every block marked Fixed passes Luau's strict type checker against Roblox's API definitions (luau-lsp, 23 October 2026), and every block marked Breaks compiles and fails only when it runs. The message wording was checked against the message format strings in Roblox Studio itself (macOS build of 13 October 2026) on 23 October 2026. The shorter "- sanitized ID:" form is how some DevForum posts quote it. A type check catches misspelt APIs and wrong types, not game logic, so playtest in Studio before you publish.

Stop hunting errors line by line.

RoCode reads the scripts in your open place, fixes the error where it happens and tells you what it changed. Free every day, no card required.