Help with: Cannot load the AnimationClipProvider Service

I’ve already racked my brains trying to resolve this error and I haven’t gotten anywhere. I don’t think it’s an error in my code but I wanted to be sure.

When I equip the sword and unequip it the first time everything is fine. However, the second time, it gives this error, and it doesn’t even make sense because this function is not used in the equip code.

When I reset I can use the sword once again, but then this error returns.

Play animation function:

function Weapon:PlayAnim(anim:Animation)

	local trackAnim = Weapon.animController:LoadAnimation(anim)

	trackAnim:Play()

	return trackAnim

end

Equip Function

function Weapon:Equip(humanoidRootPart)

	if  Weapon.CanActions then

		Weapon.CanActions = false
		
		Weapon.Model = humanoidRootPart.Parent[Weapon.Name]

		Weapon.animController =  Weapon.Model.AnimationController

		-- Animations:

		Weapon.equipAnim =  Weapon.Model.Animations:FindFirstChild("equip")

		Weapon.unequipAnim =  Weapon.Model.Animations:FindFirstChild("unequip")

		Weapon.idleAnim =  Weapon.Model.Animations:FindFirstChild("idle")

		Weapon.blockAnim =  Weapon.Model.Animations:FindFirstChild("block")

		Weapon.idleBlockAnim =  Weapon.Model.Animations:FindFirstChild("blockIdle")

		Weapon.attackAnim01 =  Weapon.Model.Animations:FindFirstChild("attack01")

		Weapon.attackAnim02 =  Weapon.Model.Animations:FindFirstChild("attack02")

		Weapon.attackAnim03 =  Weapon.Model.Animations:FindFirstChild("attack03")

		-- Sounds

		Weapon.mainSound =  Weapon.Model.Sounds.equip

		attackSound =  Weapon.Model.Sounds.attack

		Weapon.stabSound = Weapon.Model.Sounds.stab

		Weapon.blockSound = Weapon.Model.Sounds.block

		-- Equip Animation

		local trackEquipAnim =  Weapon.animController:LoadAnimation(Weapon.equipAnim)

		trackEquipAnim:Play()

		local childs = Weapon.Model:GetChildren()

		-- Loop for make viewmodel visible(Animation loading to slow dibialducionaoius)

		for i = 1, # childs, 1 do

			if  childs[i].ClassName == "MeshPart" and not ( childs[i].Name == "root") then

				childs[i].Transparency = 0	

			end
		end

		--

		spawn(function()

			local weld = Instance.new("Weld")

			weld.Parent = Weapon.Model.root

			weld.Part0 = Weapon.Model.root

			weld.Part1 = humanoidRootPart.Parent.UpperTorso


		end)

		-- Idle Anim

		task.wait(0.5)

		Weapon.mainSound:Play()

		trackEquipAnim.Stopped:Wait()

		local trackIdlepAnim =  Weapon.animController:LoadAnimation(Weapon.idleAnim)

		trackIdlepAnim:Play()

		Weapon.CanActions = true
		
	end

end

Unequip function:

function Weapon:Unequip()
	
	if Weapon.CanActions == true then
		
		Weapon.CanActions = false
		
		for _,anim in pairs( Weapon.animController:GetPlayingAnimationTracks()) do

			anim:Stop() -- To stop all animations(se não buga :\)

		end

		local anim = Weapon:PlayAnim(Weapon.unequipAnim)

		task.wait(1)

		Weapon.mainSound:Play()

		anim.Stopped:Wait()

		Weapon.CanActions = true

		Weapon.Model:Destroy()
		
	end

end

pls ignore the comments inside the code :sob:

Video:

1 Like

Where are you getting:

Weapon.animController:LoadAnimation(anim)

Is it a tool with things inside it ?

Meaby you are referencing the tool inside your Backpack but it could loose the reference because your are moving the tool from you Backpack to the player Model

“Weapon” is a table within a ModuleScript that is in the Player Character. Each time the weapon is unequipped it is destroyed. Each time it is equipped, it is cloned from ReplicatedStorage along with a new ModuleScript.

After hours of brainstorming, I managed to solve it. Nevermind.

1 Like