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

Why doesn't my reset button work?

Asked by 10 years ago

I try to make a reset button, but the script doesn't work! The script I use is this:

function onClicked(click)
script.parent.parent.parent.parent.Character.Humanoid.Health = 0
end

script.parent.MouseButton1Click:connect(click)

Mind if anyone can help?

6 answers

Log in to vote
5
Answered by
DevChris 235 Moderation Voter
10 years ago

Noticed that there was a mistake in my code below. Just fixed it. Mine should work.

Three Errors: 1. You're better off using a LocalScript. 2. You typed "Mouce" instead of "Mouse." 3. Parent needs a capital P.

Okay, first of all, are you using a LocalScript? If not, you should. Let me re-do your code for you. Put this code in a LocalScript in the place where you put your current script:

EDIT: Simplified the below code


function click() game.Players.LocalPlayer.Character.Humanoid.Health = 0 end script.Parent.MouseButton1Click:connect(click)

That should do it.

0
devChris, Thanks! Operation_Meme 890 — 10y
0
No problem. Care to accept my answer? DevChris 235 — 10y
0
I already did, but, do I need frames? Operation_Meme 890 — 10y
0
You don't need frames. DevChris 235 — 10y
0
Oh. SOme guy said I needed frames Operation_Meme 890 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

You have to capitalize Parent.

Log in to vote
0
Answered by 10 years ago
function onClicked()
    game.Players.LocalPlayer.Character.Humanoid.Health = 0
end

script.Parent.MouseButton1Down:connect(onClicked)

Let me know if that works

Log in to vote
0
Answered by
INOOBE_YT 387 Moderation Voter
10 years ago

Is it in a StarterGui and Frame and everything? I think you put too many Parents. Also it needs a capital P.

0
Do I even need frames? Operation_Meme 890 — 10y
0
I don't need frames ._. Operation_Meme 890 — 10y
Log in to vote
0
Answered by 10 years ago
function die()
    script.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0
end

script.Parent.MouseButton1Click:connect(die)

I did a youtube video on this if you want,which kinda explains on why and how all the code works.

Log in to vote
0
Answered by 7 years ago

Here is what I did for mine in Reading club : Rewritten

local Player = game.Players.LocalPlayer
function youknowalotabouttrucks()
Player.Character.Humanoid.Health = 0
end
script.Parent.MouseButton1Down:Connect(youknowalotabouttrucks)

lol

0
i hope you can read dates, this question is years old Operation_Meme 890 — 6y
0
I'm blind that's why superlaser60 0 — 6y

Answer this question