I'm trying to make a reset GUI and I don't think it's working properly
function onClicked(click)
script.Parent.Parent.Parent.Parent.Parent.Players.Character.Humanoid.Health = 0
end
script.Parent.MouseButton1Down:connect(onClicked)
I'm trying to make a reset GUI and I don't think it's working properly
function onClicked(click)
script.Parent.Parent.Parent.Parent.Parent.Players.Character.Humanoid.Health = 0
end
script.Parent.MouseButton1Down:connect(onClicked)
The gui would have to be a textbutton for this to work. Make sure it is a textbutton and instead of doing script.Parent.Parent.Parent.Parent.Parentyou could do it much easier by making the script a localscript(if it isn't already) and setting the code as this:
function onClick()
game.Players.LocalPlayer.Character:WaitForChild("Humanoid").Health = 0
end
script.Parent.MouseButton1Down:connect(onClick)
You also don't need to include a parameter for the function because you aren't using it.
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
Thank you. It worked.