So upon writing a quick and easy damage script,I keep on getting this part of an error "Human(a nil value)"
Here's the script:
--Upon stepping on the glass shard, damage will be taken.
local Human = script:FindFirstChild("Humanoid") --Required for the damage to be taken
local GlassShard = script.Parent --The object that does the damage
GlassShard.Touched:Connect(function()
Human:TakeDamage(2) --The player will take 2 damage points upon touching the shard
end)
Please tell me what's wrong with this.I don't see anything wrong.

5 comments
Thanks man.I modified it a bit so I hope you don't mind and thanks for the good luck.Good luck to you to!
why is Human global
? Why I choose "Human" as the var name? I just copyed from the original script
Welp, The humanoid goes before touch, and add a argument function(here) which distributes the function needed for the part.touch:connect thing to work but since someone solved this.
wait the humanoid varible goes like inside the function