Error: Cannot load the AnimationClipProvider Service - when the player dies

local players = game:GetService('Players')
local plr = players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local tool = script.Parent
local debounce = script.Parent.debounce

print(char)

local humanoid = char:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")

local debounce2 = true

local myAnimation = Instance.new("Animation")
myAnimation.AnimationId = "rbxassetid://11842296549" -- 0.35 seconds long

local animationTrack = animator:LoadAnimation(myAnimation)

tool.Activated:Connect(function()
	if debounce.Value and debounce2 then
		animationTrack:Play()
		game.ReplicatedStorage.events.swordevent:FireServer('hit','light')

	end
end)

The print statement gives the players name. This error only happens when the player dies

Are you playing an Animation while the Player is dead?

The error runs when the player dies whether the animation is playing or not.