Trying to make a part do damage to a player when touched but the output is saying that the "Humanoid isn't a valid member of script" and I don't really understand what it means.
And if you're wondering what I wrote then here it is.
function part()
part = script.Parent
if script.Parent.Touched then
script.Parent.Parent.CanDamage = true
game.Players.LocalPlayer.Humanoid:TakeDamage(15)
if script.Parent.TouchEnded then
script.Parent.Parent.CanDamage = false
end
end
end
part()

1 comment
You can't put an event inside an if condition, I think this is a server script so you can't do game.Players.LocalPlayer, and Humanoid is a child of the player's character, not the player itself