That’s because you didn’t write what is Humanoid, since it’s a LocalScript, you could get Humanoid like this:
local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:FindFirstChild("Humanoid")
Having a humanoid randomly defined like that, the script will be like “huh who”
You must always define the player’s humanoid so script knows who to mess with.