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 11 years ago

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

1function onClicked(click)
2script.parent.parent.parent.parent.Character.Humanoid.Health = 0
3end
4 
5script.parent.MouseButton1Click:connect(click)

Mind if anyone can help?

6 answers

Log in to vote
5
Answered by
DevChris 235 Moderation Voter
11 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

1function click()
2    game.Players.LocalPlayer.Character.Humanoid.Health = 0
3end
4 
5script.Parent.MouseButton1Click:connect(click)

That should do it.

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

You have to capitalize Parent.

Log in to vote
0
Answered by 11 years ago
1function onClicked()
2    game.Players.LocalPlayer.Character.Humanoid.Health = 0
3end
4 
5script.Parent.MouseButton1Down:connect(onClicked)

Let me know if that works

Log in to vote
0
Answered by
INOOBE_YT 387 Moderation Voter
11 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 — 11y
0
I don't need frames ._. Operation_Meme 890 — 11y
Log in to vote
0
Answered by 11 years ago
1function die()
2    script.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0
3end
4 
5script.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

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

lol

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

Answer this question