"Invalid animation id '<error: unknown AssetId protocol>':"

So I was trying to use a sword animation that I made with this local script:

local Tool = script.Parent
local Handle = Tool:WaitForChild("Handle")
local SwordAnimation = Instance.new("Animation")
local LocalPlayer = game.Players.LocalPlayer
local plrChar = LocalPlayer.Character or LocalPlayer.CharacterAdded:wait()

SwordAnimation.Name = "SwordAnimation"
SwordAnimation.AnimationId = 5240166465
SwordAnimation.Parent = Tool

local SwordAnim = plrChar:WaitForChild("Humanoid"):LoadAnimation(SwordAnimation)
Tool.Activated:Connect(function()
	SwordAnim:Play() -- The animation will replicate to the server and other clients too
end)

But then I got this strange error that I have not seen before…

animation issue image

Does anyone know why I got this mysterious error and what it means ?

1 Like

Try doing SwordAnimation.AnimationId = "rbxassetid://5240166465"

3 Likes

Well sometimes you overlook things and make them seem harder than they actually are but in reality they are much simpler than you think :joy:

2 Likes