How do I fix the "Cannot load the AnimationClipProvider Service" error?

Hello! So I have a script that plays an animation when a prompt if triggered. But for some reason I get spammed with this error:
image
This is my script:

local Players = game:GetService("Players")

local Player = Players:WaitForChild("TabbyCat904")
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")

local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://14639655080"

script.Parent.Triggered:Connect(function()
	local AnimationTrack = Humanoid:LoadAnimation(Animation)
	script.Parent:WaitForChild("Sound"):Play()
	AnimationTrack:Play()
end)

If you think you know what went wrong, please let me know. Thank you and have a wonderful day! :slight_smile:

3 Likes

That is deprecated, meaning that it will no long work in new work. The reason why is that you are loading the animation using the humanoid which has been deprecated. Use Humanoid:WaitForChild("Animator"):LoadAnimation(Animation) instead.

Hopefully, this would work. Good luck!

1 Like

It didn’t work. It usually spams my output with the error after I’ve died. This is my code now:

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")

local Player = Players:WaitForChild("TabbyCat904")
local Character = Player.Character or Player.CharacterAppearanceLoaded:Wait() or game.Workspace:WaitForChild(Player.Name)

local Sound = script.Parent:WaitForChild("Sound")

local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://14639655080"

script.Parent.Triggered:Connect(function()
	--Player.CharacterAdded:Wait()
	local Humanoid = Character:WaitForChild("Humanoid")
	
	RunService.Stepped:Wait()
	local animation = Humanoid:WaitForChild("Animator"):LoadAnimation(Animation)
	Sound:Play()
	animation:Play()
end)
1 Like

Try parenting the newly created animation instance somewhere. Usually, if you don’t parent a created instance somewhere, it will get deleted. That is what may be causing the animation to not be loaded.

2 Likes

How can I set the parent of the animation? I think the Parent property is locked.

I think you might be talking about AnimationTrack.

By using Instance.new("Animation"), you are creating an instance similar to these:
image

In order for an AnimationTrack to load, it needs an Animation. Since your AnimationTrack attempts to load the Animation after it is deleted due to not being parented, it throws the error.

For simplicity’s sake, you can parent the animation under the script like this:

local Animation = Instance.new("Animation")
Animation.Parent = script
Animation.AnimationId = "rbxassetid://14639655080"
1 Like

deprecated doesnt mean it wont work, humanoid:loadanimation still works it is just not recommended for new places. that doesnt mean that you cant use it, it still functions.

That didn’t seem to work either.

Ah, alright then, thank you for that information.