Need help with loading animations

I’m making a gun system for my game but when I play test and reset my character this error pops up:
cannot load the AnimationClipProvider Service.

I tried somethings like task.wait(2) but not working too.

Heres the code(Client) for loading the animations:

for i,v in pairs(Animations:GetChildren()) do
	if v:IsA("Animation") then
		if v.AnimationId == nil then
			v.AnimationId = "rbxassetid://0"
		end
		
		Anims[v.Name] = Humanoid:LoadAnimation(v)
	end
end

humanoid:LoadAnimation is deprecated, try using Humanoid.Animator:LoadAnimation()

It’s giving the same error on reseting (resetting? idk)

when is the script being executed

I mean it’s a Tool so i think maybe on player load or when the character equips it

try linking that section of a code to a Tool.Equipped function

local tool = script.Parent -- or replace this with the tool's reference
tool.Equipped:Connect(function()
end

something like that cause, when researching this problem most of the suggestion say its caused from the character model not being loaded in yet

Noooooo, it’s not working too : (

darn, i Honestly have no clue my last guess would to add at the beginning before it runs

local char = game:GetService("Players").LocalPlayer.Character or game:GetService("Players").LocalPlayer.CharacterAdded:Wait()

anyways i wish you luck

Guess what. I already have that:

local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()

try changing it to this, i tried to replicate that error but havent gotten it, the only other error was it cannot load a the “rbxassetid://0” since its not a thing

for i,v in ipairs(Animations:GetChildren()) do
if v:IsA("Animation") and v.AnimationId ~= (nil or ' ') then
Anims[v.Name] = Humanoid.Animator:LoadAnimation()
end

Does not work too and I mean it’s only when you reset and not when you spawn

welp i did all that i could :man_shrugging: i hope you find the problem

1 Like

Do you want it to play when you press left click?

I somehow fixed it with task.wait(2)

1 Like

Animation = Instance.new("Animation") Animation.Parent = game.Workspace Animation.AnimationId = "http://www.roblox.com/asset/?id=8483249725" local Player = game.Players.LocalPlayer local mouse = game.Players.LocalPlayer:GetMouse() mouse.KeyDown:connect(function (key) for i, v in pairs(game.Players:GetChildren()) do if key == "e" then local AnimationTrack = Player.Character.Humanoid:LoadAnimation(Animation) AnimationTrack:Play() end end end)