So following my first question, I did some scripting tutorials and leaned a bit of scripting. What I'm trying to achieve here is that when people click the part, they instantly die. I have added the script and click detector inside the part. My code is below.
local part = script.Parent
local function kill(otherpart)
local partparent = otherpart.parent
local humanoid = partparent:FindFirstChild("Humanoid")
if humanoid then
humanoid.Health = 0
end
end
part.MouseClick:connect(kill)
Please tell me where I went wrong. Thank you!

4 comments
Those of you who will reference me to peasfactory, note that I have made this code inspired by his tutorial.
You need a click detector for mouseclick. it would be part.ClickDetector.MouseClick:Connect(kill)
otherpart should be the player who clicked it?
So I tried it with the click detector, and it didn't work. And I'm sorry, but I don't understand your second comment.