As the title said I am running into an issue with the “Cannot load the AnimationClipProvider Service”
after the player has died or resets. However if the player never dies/resets the animations play as expected.
This script is running in StarterPlayerScripts as a LocalScript
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local function playAnimation(animationId)
if not character and not humanoid then return end
local animator = humanoid:FindFirstChild("Animator")
if not animator then
warn("⚠️ No Animator found! Creating one...")
animator = Instance.new("Animator")
animator.Parent = humanoid
end
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://" .. tostring(animationId)
local animationTrack = animator:LoadAnimation(animation) --This is the line the error is happening on.
animationTrack:Play()
return animationTrack
end
local function stopHoldingAnimation()
if holdingAnimation then
holdingAnimation:Stop()
holdingAnimation = nil --sets to nil if player isn't holding a weapon
end
end
--The below function plays/stops the animations based if the character has a gun out
local function onWeaponSwitch(...)
local Gun_Information = {...}
if #Gun_Information ~= 0 then
Gun_Name = Gun_Information[1]
Gun_Stats = Gun_Information[2]
canShoot = true
print("[DEBUG] Client Equipped Gun: "..Gun_Name)
Current_Gun = Gun_Name
Tool = character:FindFirstChild(Gun_Name)
if Gun_Stats then
Ammo = Gun_Stats.MaxAmmo
playHoldingAnimation()
else
error("[DEBUG] Gun configurations not found for "..Gun_Name..".")
end
else
Current_Gun = nil
Gun_Stats = nil
Ammo = 0
canShoot = true
stopHoldingAnimation()
end
updateMouseCrosshair()
end