So I was making a shotgun weapon when I came across 2 errors. I was trying to load an animation from a LocalScript. The animation objects were inside the tool itself. The first error I came across was: "LoadAnimation requires the Humanoid object (Player1.Humanoid) to be a descendant of the game object" This is when I tested the game in solo mode on studio. The second error I got on a server was: "Players.Cowation.Backpack.Shotgun.Shotgun:5: attempt to index local 'character' (a nil value)" Clearly, the Character object is not a nil value. Apparently when trying to call to it, the script just outputs an error. The following is a bunch of code segments that I pulled from the LocalScript regarding the error. Here is an image of the layout of the tool.
local tool = script.Parent
local character = game.Players.localPlayer.Character
local humanoid = character.Humanoid
local idle = tool.Idle -- Anim Object
local activate = tool.Activate -- Anim Object
local animTrackIdle = humanoid:LoadAnimation(idle)
local animTrackActivate = humanoid:LoadAnimation(activate)
local function onAnimationEquip()
animTrackIdle:Play()
end
local function onAnimationActivate()
animTrackActivate:Play()
end
tool.Equipped:connect(onAnimationEquip)
tool.Activated:connect(onAnimationActivate)
Please help, I've seen others have this problem but none of the answers that I have seen were really clear to me.
if nobody answers that's fine

2 comments
Try Torso or Humanoidrootpart if torso dont work
I don't really understand what you are trying to say. I'm trying to get the definitions for the Character on Server Mode and also trying to fix the error in Studio Mode.