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?
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.
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.
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