Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 7 years ago
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

Log in to vote
0
Answered by 7 years ago

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!

0
I'm assuming he's using a ClickDetector, not a GUI. User#11440 120 — 7y
0
No, actually it's unclear isn't it. The function name can be anything, but sure. This script isn't bad. User#11440 120 — 7y
Ad

Answer this question