Error - Cannot load the AnimationClipProvider service

im currently having this issue, anyone else?

3 Likes

put wait() on first line.
trust me.

28 Likes

print(“THANK U THANK YOOYYOYUUUYUUYUYYUUYUYUYUYU”);

3 Likes

To solve the problem, type this before loading the animations:

repeat
        task.wait(1)
until humanoid.Parent.Parent == workspace

the reason of the error is trying to load the animations on the character before it is fully loaded in the workspace, hope this helped.

2 Likes
repeat task.wait(1) until humanoid.Parent.Parent == workspace

also works and saves 2 lines

4 Likes
while humanoid.Parent.Parent ~= workspace do
        task.wait(1)
end

will not make it work.
the reason your code make them work is it must makes all the code wait.
just… what code need is wait() .

4 Likes

This error also happens to me and this was the solution I found:
Put this before the character variable

Player.CharacterAppearanceLoaded:Wait()

1 Like

What? His code does work, however, as it’s a repeat loop, the code will run and the condition later, a while loops runs the condition first.

Also, don’t use ~= workspace or == workspace, since you may use custom character parent (like a folder)

Instead do:

while char.Parent == nil do
       task.wait()
end
1 Like

OH MY GOD THANK YOU

while task.wait (0.01) do
warn("THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU")

end

Hey roblox, i’m looking at you. Please fix this bug.

2 Likes

press like(heart shape) button for me :wink:

13 Likes

Okay so I found a solution to this, however it might not be one for a lot of you guys (I used Promise.lua)

--// My Util Module

local myUtil = {}

local function loadAnimation(hum, anim)
	return Promise.new(function(resolve, reject)
		local animTrack;

		local success, output = pcall(function()
			animTrack = hum:LoadAnimation(anim)
		end)	

		if not success then
			reject()
		else
			resolve(animTrack)
		end
	end)
end

function myUtil:fetchAnimTrack(hum,anim)
	return Promise.retryWithDelay(
		loadAnimation, 5, 1,
		hum, anim
	):expect()
end

return myUtil

This function safely loads any AnimationTracks and returns them.

Just run:

myUtil:fetchAnimTrack(someHumanoid, someAnimationInstance)
9 Likes

This is the solution, thanks! I hope the post author marks your answer. What I did was I made sure to parent my npc to workspace before loading animations!

I had this problem for a while this solved everything thank you so much

1 Like

You need to parent the button before loading the animation

Wanted to add my tuppence while this is still considered current.

I have found it necessary to wait a small time after player.CharacterAdded:Connect(onCharacterAdded) fires.

I don’t actually call wait or task.wait, which is generally frowned upon, not that would stop me. Instead I add accessories (just my hat) which seems to impart all the delay I need. Here are my timings:

  23:30:54.818  too soon to `animator:LoadAnimation(animation)`
  23:30:55.114  1772336109 Enum.AccessoryType.Hat
  23:30:55.428  not too soon to `animator:LoadAnimation(animation)`

So yeah, I’m effectively waiting some arbitrary time of about 0.5s, which is bad practice, but it works so why complain?

The elaborate solutions above look nice, but there is nothing specifically to wait for, in either case (both too soon and not too soon):

print(player.Character.Humanoid.Parent.Parent)

returned nil. Which I don’t understand because:

player.Character.Humanoid.Parent.Parent == player.Character.Parent == player

Nothing is impossible, or completely broken, my last answer got me thinking. We do have something to wait for; the success of the call itself.

In lua we handle exceptions using pcall. The canonical solution is therefore:

function safelyLoadTrack(animator: Animator, animation: Animation): AnimationTrack
    local success, errorOrData
    repeat
        success, errorOrData = pcall(function()
            return animator:LoadAnimation(animation)
        end)
        if not success then
            warn(errorOrData) -- We're calling it too early but ideally we'd check that with this error message, which we can at least preserve verbatim.
            task.wait(0.2)
        end
    until success
	return errorOrData
end

A word of caution on exception handling, don’t ignore errors. Ideally we’d test the errorOrData message is what we expect, and not something pertaining to a non-existant, or bad, animation, or the servers being down.

The error message I expect is:

Cannot load the AnimationClipProvider Service.

but that isn’t formally specified nor guaranteed not to change with future updates.

2 Likes

for me personally the fix wasnt any waits or nothing it was simply the fact i played 2 same animations at the same time that caused the error for me, i had an ancestry changed event connected to an instance that was parented to the character, which after its deleted, plays an animation, i also had a play animation on respawn, since my respawn time was low it was pretty much instant so both (same animations) tried to play vs each other giving me the error, after adding a health>0 check in my ancestry event the error is gone maybe someone has this exact problem if so theres ur fix

out of all the solutions this was the best for me,
thanks.

2 Likes

still doesn’t work for me , ill have to search some more

This Module Script can probably fix all the problems and its pretty self explanatory on how to use it, but make sure that once your character dies, you reload the animations or else it wont work because it loads it onto the current animator, which if the character dies, is destroyed

--〔 Services 〕--
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")

--〔 Variables 〕--
local AnimationHandler = {
	["LoadedAnimations"] = {};
}

local AnimationsFolder = ReplicatedStorage.Assets.Animations

--〔 Functions 〕--
function FireHostWarning()
	if not RunService:IsClient() then
		warn("This aspect of AnimationHandler cannot be utilized by the Server.")
	end
end

function FireValidityWarning(Input)
	local Debounce = false

	if typeof(Input) ~= "string" then
		warn("Animation Names must be in string format.")
		return
	end

	for Index, Animation in ipairs(AnimationsFolder:GetDescendants()) do
		if Animation:IsA("Animation") then
			if Animation.Name == Input then
				Debounce = true
				break
			end
		end
	end

	if not Debounce then
		warn("'"..Input.."' is not a valid Animation.")
	end
end

--〔 Module Functions 〕--
function AnimationHandler:LoadAnimations(Player)
	if not RunService:IsClient() then FireHostWarning() return end

	local Character = Player.Character
	local Humanoid = Character:WaitForChild("Humanoid")
	local Animator = Humanoid:FindFirstChildOfClass("Animator") or Humanoid

	table.clear(AnimationHandler.LoadedAnimations)

	for Index, Animation in ipairs(AnimationsFolder:GetDescendants()) do
		if Animation:IsA("Animation") then
			AnimationHandler.LoadedAnimations[Animation.Name] = Animator:LoadAnimation(Animation)
		end
	end
end

AnimationHandler["PlayAnimation"] = function(Animation, Properties)
	if not RunService:IsClient() then FireHostWarning() return end

	if typeof(Animation) ~= "string" then FireValidityWarning(Animation) return end
	FireValidityWarning(Animation)

	local Animation = AnimationHandler.LoadedAnimations[Animation]

	local AdjustSpeed = Properties and Properties.AdjustSpeed or 1
	local Weight = Properties and Properties.Weight or 1
	local FadeIn = Properties and Properties.FadeIn or 0
	local FadeOut = Properties and Properties.FadeOut or 0
	local Looped = Properties and Properties.Looped or Animation.Looped
	local Duration = Properties and Properties.Duration or false

	Animation:Play(FadeIn, Weight, AdjustSpeed)
	Animation.Looped = Looped

	if Duration then
		task.delay(Duration, function()
			Animation:Stop(FadeOut)
		end)
	else
		if not Looped then
			task.delay(Animation.Length, function()
				Animation:Stop(FadeOut)
			end)
		end
	end
end

AnimationHandler["StopAnimation"] = function(Animation, Properties)
	if not RunService:IsClient() then FireHostWarning() return end

	if typeof(Animation) ~= "string" then FireValidityWarning(Animation) return end
	FireValidityWarning(Animation)

	local Animation = AnimationHandler.LoadedAnimations[Animation]

	local FadeOut = Properties and Properties.FadeOut or 0

	if Animation.IsPlaying then
		Animation:Stop(FadeOut)
	end
end

AnimationHandler["StopAllAnimations"] = function(Properties)
	if not RunService:IsClient() then FireHostWarning() return end

	local FadeOut = Properties and Properties.FadeOut or 0

	for Index, AnimationTrack in pairs(AnimationHandler.LoadedAnimations) do
		if AnimationTrack.IsPlaying then
			AnimationTrack:Stop(FadeOut)
		end
	end
end

--〔 Return 〕--
return AnimationHandler
2 Likes