Cannot load the AnimationClipProviderService, even though I am waiting and making sure the character exists

I have this following code:

RunService.Stepped:Wait()
print(User) -- prints out `winterscode` in this case

local Humanoid = User:WaitForChild('Humanoid')
local Animator = Humanoid:WaitForChild('Animator')
for _, Animation in ipairs(self.DataMod.SwingAnims) do
	local Track = Animator:LoadAnimation(Animation)

However, I am getting the Cannot load the AnimationClipProviderService error. I tried using wait, task.wait, and repeat task.wait() until User.Parent = workspace, and they all don’t work, but the last on yields the script forever. Help appreciated ^^

Edit: The code formatting kinda broke on copy-paste

1 Like

I take it you arent moving the character, it’s just in the workspace?

Because a common way you get this error is having a humanoid/animator try to load an animation when it’s not in the workspace, You should check out WorldModels!

1 Like

I tried to make sure the character was in the workspace, but that just got the code stuck in an infinite loop.

1 Like

So the character never enters the workspace.

Make sure the CharacterAutoLoads property on game.Players is true

It is enabled. I am also getting the character (the User variable) with the CharacterAdded function.

Could you give me the rest of your script?

This is the part getting the character:

local ReplicatedStorage = game:GetService('ReplicatedStorage')
local Players = game:GetService('Players')
local Item = require(ReplicatedStorage.Modules.Item)

local Player = Players.LocalPlayer

local function setup(Char)
	local Model = script:WaitForChild('Model')

	Item.init(script.Parent, script.Parent, Model, Char)

	local Saber = require(ReplicatedStorage.Modules.Saber).new(script.Parent,
		Char,
		"Single"
	)
end

setup(Player.Character or Player.CharacterAdded:Wait())
Player.CharacterAppearanceLoaded:Connect(setup)

This is the part throwing the error (on the Animator:LoadAnimation call)

function Saber.new(Tool, User, Type)
	
	-- Make sure the weapon type exists
	assert(WeaponData:FindFirstChild(Type), string.format("No weapon of type %s!", Type))
	
	-- Create the weapon object
	local self = setmetatable({}, Saber)
	
	-- Load the properties of the weapon
	self.Tool = Tool
	self.Type = Type
	self.User = User
	self.DataMod = require(WeaponData:FindFirstChild(Type))
	self.BlockTrack = nil
	self.ACTrack = nil
	self.SwingTracks = {}
	self.CurrentSwingTrack = nil
	self.CurrentCombo = 0
	self.MaxCombo = #self.DataMod.SwingAnims
	self.PassedDamage = false
	self.LastSwingBenchmark = 0
	self.LastACTime = 0
	
	-- Load the humanoid and the animator
	local Humanoid = User:WaitForChild('Humanoid')
	local Animator = Humanoid:WaitForChild('Animator')
	
	-- Load the swing animations
	for _, Animation in ipairs(self.DataMod.SwingAnims) do
		
		-- Create the Animation Track
		local Track = Animator:LoadAnimation(Animation)
		table.insert(self.SwingTracks, Track)	

use CharacterAdded instead

It still throws the same error :confused:

Have you tried adding print statements everywhere and delays in certain spots to wait for it to be loaded?

I have, and I have tried adding in a line that waits for the character to be a child of Workspace, but that just causes the script to yield forever.

When you run the game, does the character appear to be in the workspace on your explorer?

It works fine when the player first loads, but as the title says, it breaks when the player respawns. And yes, the character shows in the workspace on respawn. When I disable the script with the CharacterAdded, I respawn normally, and nothing is tampering with the parent of User.

I fixed it; The problem was that the character that Player.CharacterAdded returns never gets placed in the workspace, at least in my project. I had to wait a frame with RunService.RenderStepped:Wait() and then get the character after that. Thanks for the help though!

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