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

why doesnt my button that kills when it is clicked work right?

function onClick (part)
local.humanoid.health(0)

end

sorry im a new scripter! if you have any tips please leave them below and thanks!

1 answer

✓ Accepted answer

Your revised script:

function click()
    game.Players.LocalPlayer.Character.Humanoid.Health = 0
end

script.Parent.MouseButton1Click:connect(click)

1] You don't need the 'on' when you put 'onClick'. Also, when using a GUI, you don't need to specify "part" unless you're using a brick that kills the user.

2] When you're showing the value you don't need the parenthesis (0), it's better to use '= value' instead.

Hope this helped a bit!

2 comments

0

I'm assuming he's using a ClickDetector, not a GUI.

0

No, actually it's unclear isn't it. The function name can be anything, but sure. This script isn't bad.

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