Cannot load the AnimationClipProvider Service

I’m making a tool that has a local script inside of it, which handles the animations. The tool is also placed inside the StarterPack.

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

local animation = tool:WaitForChild("Animation")
local animationTrack = animator:LoadAnimation(animationTrack)

The animation works when the character first loads, but when they reset the error, “Cannot load the AnimationClipProvider Service.” shows up on the line where the animation is supposed to load the animation.

There’s two other posts about this error where people suggested to stick a repeat loop before the animation is loaded to wait until the character is a descendent or parented to the workspace. But when I tried to do that the script just yields forever. (which is weird because the character is loaded)

I think this is a Roblox bug, so if there is a workaround let me know.

This is not a bug per se, what’s most likely happening is you are trying to load the animation when the character is parented to nill; verify this by doing print(character.Parent); and when you do that it raises that error. So all you gotta do is make sure the character is not parented to nil when loading the animation.

put this in the starting of the script

repeat wait() until game.Players.LocalPlayer.Character.Parent = workspace end

OR maybe this

repeat wait() until game:IsLoaded end

So I used to have the same problem with my gun tool but ive come up with a good solution

My Script:

local player = game:GetService("Players").LocalPlayer

local Character
local Humanoid
local Animator

local AnimationTrack

local tool = script.Parent


    Character = player.Character
	Humanoid = Character:WaitForChild("Humanoid")
	Animator = Humanoid.Animator

    AnimationTrack = Animator:LoadAnimation(ANIMATION U WANT TO PLAY)


And then you can also stop the animation with when u unequip the tool. Hopefully this helps you.

1 Like

Thank you, it worked!

I edited the code so that it only loads the animation once when the tool is equipped.

local player = game:GetService("Players").LocalPlayer

local character
local humanoid
local animator

local animationTrack

local tool = script.Parent

    if not character then
        character = player.Character or player.CharacterAdded:Wait()
		humanoid = character:WaitForChild("Humanoid")
		animator = humanoid:WaitForChild("Animator")

        animationTrack = animator:LoadAnimation(ANIMATION U WANT TO PLAY)

That’s an interesting solution you got there! It’s already solved, but I just wanted to give my take on how I solve this issue.

Guessing that the script is a child of the tool, I just add this one line at the very top of every single tool script I do:

repeat task.wait() until script.Parent.Parent.Parent:IsA("Player")

That’s pretty much it, a simple one-liner.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.