local Target = script.Parent
function onClick(Brick)
local Player = Brick.Parent:findFirstChild("Humanoid")
if (Player ~= nil) then
Player.Health = Player.Health - 100
end
end
Target.ClickDetector.MouseClick:connect(onClick)
COMMUNITY QUESTION
When I click this part why am I not Destroyed?
1 answer
Use this instead.
local Target = script.Parent
function onClick(Brick)
local h = Brick.Parent:findFirstChild("Humanoid")
if(h~=nil)then
h.Health = 0
end
end
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.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Is it outputting anything?