Getting a " Cannot load the AnimationClipProvider Service" error

I’m getting this error from a local script only after my character respawns. First spawn, everything works as intended, but once the player dies and respawns, the error appears. I’ve tried searching the dev forum, googling it, and asking chatgpt, but the suggestions, such as putting game:GetService(“RunSeriver”).Stepped:Wait() before each time you call LoadAnimation, don’t work as I still get the error. I even wait for the player’s animator object. Any help on diagnosing the cause and fixing this bug would be appreciated.

1 Like

We can’t fix the error without knowing your code. Please send it here

It ‘could’ be because when you die the script is still trying to use the old Animator in the character humanoid (the animator from the dead character) and therefore you get the error.

This is the code:

local tool = script.Parent
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local animator = character:WaitForChild("Humanoid"):WaitForChild("Animator")
local RunService = game:GetService("RunService")
--
local idleAnimation = Instance.new("Animation")
idleAnimation.AnimationId = "rbxassetid://15444367819"
RunService.Stepped:Wait()
local idleTrack = animator:LoadAnimation(idleAnimation)
idleTrack.Priority = Enum.AnimationPriority.Idle
--15444487239
local useAnimation = Instance.new("Animation")
useAnimation.AnimationId = "rbxassetid://15444487239"
RunService.Stepped:Wait()
local useTrack = animator:LoadAnimation(useAnimation)
useTrack.Priority = Enum.AnimationPriority.Action

tool.Equipped:Connect(function()
	idleTrack:Play()
end)

tool.Unequipped:Connect(function()
	idleTrack:Stop()
end)

tool.Activated:Connect(function()
	useTrack:Play()
	useTrack:GetMarkerReachedSignal("inject"):Connect(function()
		print("inject")
		tool:WaitForChild("stab"):Play()
	end)
	useTrack:GetMarkerReachedSignal("plungerDown"):Connect(function()
		print("plungerDown")
		tool:WaitForChild("insert"):Play()
	end)
	useTrack:GetMarkerReachedSignal("throw"):Connect(function()
		tool:WaitForChild("drop"):Play()
		idleTrack:Stop()
		local humanoid = character:FindFirstChild("Humanoid", true)
		local greenBar = player:FindFirstChild("greenBar", true)
		tool:WaitForChild("heal"):FireServer()
		for i=1, 10, 1 do --add this effect on the hudManager where it detects health changes
			greenBar.Parent.BorderColor3 = Color3.new(0, 1, 0)
			wait()
			greenBar.Parent.BorderColor3 = Color3.new(0, 0, 0)
			wait()
		end
	end)
end)

“local idleTrack = animator:LoadAnimation(idleAnimation)” triggers the error

You need to update the character when the player respawns, else it would try to load the animation on the old character (edit: I forgot that you have to reload the animations)

player.CharacterAdded:Connect(function(newCharacter) -- fires when player respawns
character = newCharacter
animator = newCharacter:WaitForChild("Humanoid"):WaitForChild("Animator")
idleTrack = animator:LoadAnimation(idleAnimation)
idleTrack.Priority = Enum.AnimationPriority.Idle
useTrack = animator:LoadAnimation(useAnimation)
useTrack.Priority = Enum.AnimationPriority.Action
end)

↓ answering this as well ↓

I came across this potential solution while browsing the internet, but I don’t know if that’s that problem because the LocalScript that’s giving me this error is stored within StarterPack within a tool, which is replicated upon the spawning of a character, so the animator reference should update the new character’s animator.

Despite that reasoning and assuming it is trying to reference the old animator, how would I reference the current animator?

I pasted it in the LocalScript which gives the error and it didn’t work (gives the same error, nothing changed) because the character added event wouldn’t run inside a LocalScript within a tool because the character has to already be added to the workspace when a tool is inserted.

btw I even tried your updated code just to give you the benefit of the doubt

Ok, so for me I found a unique solution. I just called wait() at the top of my LocalScript and now it runs every time without giving me the error.

Before fixing my bug, I found this solution (Error - Cannot load the AnimationClipProvider service - #7 by bubbavimto), and while it helped, it didn’t fix it in all cases.

I’m not sure if this is a Roblox engine bug, but ig I found a workaround so I’m not gonna question it anymore because I’ve been stuck up on this for a couple of days.

2 Likes

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