Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make it, so when I click a part, it kills the player who clicked it?

I tried using a simple kill brick script, but instead of touching it, I tried to make it so that the kill-code triggers when the player clicks it. I basically tried to make the start event comply with the ClickDetector.

script.Parent:mouseClick1(function(kill)
	local human = kill.Parent:findFirstChild("Humanoid")
	if human then
		human.Health = 0
	end
end)
-- I added ClickDetector to the parent of this script.

1 answer

✓ Accepted answer

Your problem here is you're using the wrong terms, 'mouseClick1' won't work,

Instead, change line 1 to this:

script.Parent:MouseButton1Click:Connect(function(kill)

1 comment

0

Thanks, ryanaskew!!! This could work with sooo many things relating to clicking stuff!!! (This is not sarcasm. I actually owe you a thanks to this, dude)

This discussion is preserved as it was. New answers, comments, and votes are closed.