You might want to call :WaitForChild() on the Humanoid, it might not exist when the script runs. Also, double check that there’s a humanoid in the explorer (in Studio, not during a play test) for the script to refer to in the first place.
Another small unrelated note, but if you’re using Humanoid:LoadAnimation(), it’s good practice to always call :WaitForChild() on the Animator in advance, or else the client’s animations might not replicate to the server. See this announcement for more info.