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

Why doesn't my reset button work?

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

✓ Accepted answer

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.

5 comments

0

devChris, Thanks!

0

No problem. Care to accept my answer?

0

I already did, but, do I need frames?

0

You don't need frames.

0

Oh. SOme guy said I needed frames

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

script.Parent.MouseButton1Down:connect(onClicked)

Let me know if that works

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

2 comments

0

Do I even need frames?

0

I don't need frames ._.

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.

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

2 comments

0

i hope you can read dates, this question is years old

0

I'm blind that's why

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