LocalScript throwing error regarding character ancestry

Recently, I’ve been getting the following error whenever I try to call.

Humanoid:LoadAnimation()

I’ve got no idea why this keeps happening and it’s a tad annoying. Furthermore, this only seems to happen after the player has died.

This is what the script looks like:

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local controller = require(script.Parent.WeaponControlModule)
local tool = script.Parent
local weapon = controller.Initialise(Character)

tool.Equipped:Connect(function()
weapon:Equip()
end)

tool.Unequipped:Connect(function()
weapon:Unequip()
end)