Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why is the Animation Id failing to load?

I tried making keybind animations. They work just fine aside the error:

AnimationId failed to load

or something.

Here's the script:

local rs = game:GetService("ReplicatedStorage")

local e1 = rs.Move1Play
local e2 = rs.Move2Play
local e3 = rs.Move3Play
local e4 = rs.Move4Play

local id1 = workspace.MoveId1 -- The value is 4951461649
local id2 = workspace.MoveId2 -- The value is 4951461649
local id3 = workspace.MoveId3 -- The value is 4946579253
local id4 = workspace.MoveId4 -- The value is 4946579253



do
	
local function play1(plr)
	
	local char = plr.Character or plr.CharacterAdded:Wait()
	local h = char:FindFirstChild("Humanoid")
	
	local anim = Instance.new("Animation")
	
	if id1.Value then
	anim.AnimationId = "http://www.roblox.com/asset/?id=" .. tostring(id1.Value)
	end
	
	local track = h:LoadAnimation(anim)
	track:Play()
	
	end
	
			e1.OnServerEvent:Connect(play1)
	
end


do
	
local function play2(plr)
	
	local char = plr.Character or plr.CharacterAdded:Wait()
	local h = char:FindFirstChild("Humanoid")
	
	local anim = Instance.new("Animation")
	
	if id2.Value then
	anim.AnimationId = "http://www.roblox.com/asset/?id=" .. tostring(id2.Value)
	end
	
	local track = h:LoadAnimation(anim)
	track:Play()
	
	end
	
		e2.OnServerEvent:Connect(play2)
	
end


do
	
local function play3(plr)
	
	local char = plr.Character or plr.CharacterAdded:Wait()
	local h = char:FindFirstChild("Humanoid")
	
	local anim = Instance.new("Animation")
	
	if id3.Value then
	anim.AnimationId = "http://www.roblox.com/asset/?id=" .. tostring(id3.Value)
	end
	
	local track = h:LoadAnimation(anim)
	track:Play()
	
	end
	
		e3.OnServerEvent:Connect(play3)
	
end


do
	
local function play4(plr)
	
	local char = plr.Character or plr.CharacterAdded:Wait()
	local h = char:FindFirstChild("Humanoid")
	
	local anim = Instance.new("Animation")
	
	if id4.Value then
	anim.AnimationId = "http://www.roblox.com/asset/?id=" .. tostring(id4.Value)
	end
	
	local track = h:LoadAnimation(anim)
	track:Play()
	
	end
	
		e4.OnServerEvent:Connect(play4)
	
end

4 comments

1

No need to make 3 functions for practically the same operation. I can't really tell what is happening since I haven't an idea as to how those ids actually look, but it seems Roblox is failing to load your ids. So, if I were you, I would make a table of all those ids and set anim.AnimationId equal to each table using a for loop.

1

Also, no need to use that 'do' statement either.

0

Any ideas on how to fix it though?

0

Those are the values.

2 answers

You either haven’t made a GUI or didn’t put it in the GUI. If you haven’t made a GUI then the animation won’t work for reasons that can be answered easily.

3 comments

0

why would i need a gui?

0

So they can use the animation. As I said it’s self explanatory.

0

Why do they need a GUI to use the animation?

This discussion is preserved as it was. New answers, comments, and votes are closed.