Your player doesn’t have a character when you’re trying to call this. So to fix it (Since you said you took the script from a tool.) You can do the following code to wait for the character. Or you can put the local script you’re currently using in StarterPlayer > StarterCharacterScripts.
local character = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
local animation = character.Humanoid:LoadAnimation(script.Parent.Animation)