Localscript not finding humanoid

My Localscript is correctly identifying the character model, however when I try to use the humanoid, my script doesn’t work and I get an error in output that looks like this:

Players.AbsurdAwesome101.Backpack.Pickaxe.Local:6: attempt to index nil with 'LoadAnimation'  -  Client - Local:5

Here is my full script:

local pick = script.Parent
local char = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
local pickanim = script.Parent.PickHit

local picktrack = char.Humanoid:LoadAnimation(pickanim)

pick.Activated:Connect(function()
	script.Disabled = true
	picktrack.Priority = Enum.AnimationPriority.Action
	picktrack.Looped = false

	picktrack:Play()

	wait(0.3)
	script.Disabled = false
end)

pick.Equipped:Connect(function()
	char.RightArm.LocalTransparencyModifier = 0
end)

pick.Unequipped:Connect(function()
	char.RightArm.LocalTransparencyModifier = 1
end)


Any help would be appreciated!

--change it to 
local picktrack = char:WaitForChild("Humanoid"):LoadAnimation(pickanim)
1 Like