1 | local Target = script.Parent |
2 | function onClick(Brick) |
3 | local Player = Brick.Parent:findFirstChild( "Humanoid" ) |
4 | if (Player ~ = nil ) then |
5 | Player.Health = Player.Health - 100 |
6 | end |
7 | end |
8 | Target.ClickDetector.MouseClick:connect(onClick) |
Use this instead.
1 | local Target = script.Parent |
2 | function onClick(Brick) |
3 | local h = Brick.Parent:findFirstChild( "Humanoid" ) |
4 | if (h~ = nil ) then |
5 | h.Health = 0 |
6 | end |
7 | end |
8 | Target.ClickDetector.MouseClick:connect(onClick) |
Hex's code had a minor error, he used "FindFirstChild" instead of "findFirstChild" and also you can change the local"h" to whatever you desire.