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

Reset GUI Issue?

Asked by 10 years ago

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(o­nClicked)

1 answer

Log in to vote
3
Answered by 10 years ago

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.

0
Thank you. It worked. jellyboy90 5 — 10y
Ad

Answer this question