I am trying to make an animation when you pick up stuff but it keeps saying:
Workspace.Part.Script:2: attempt to index nil with 'Character'
script.Parent.ClickDetector.MouseClick:Connect(function()
local ani = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Pickup)
ani:Play()
end)

6 comments
it cant find ani thats why
ani is in the click detector function thing but your looking for it in a place it isnt
You are trying to interact with something that doesnt exist.
Server-sided Scripts aren't localized, obviously, therefore no pointer exists to a linked Client Instance. Fortunately, the MouseClick RBXScriptSignal provides a parameter that refers to the Player Object of the user that clicked, so you can simply utilize that.
CJ, "ani" is short for "Animation". It's a variable used to reference the AnimationTrack Object that's returned by the :LoadAnimation() method of Humanoid.
If you don't need to reference the Object anywhere else, Error_404, then declaring a variable is redundant. You can directly call the :Play() method onto :LoadAnimation() due to it's Object-return.