I'm trying to make a GUI that includes multiple small functions(such as a button that lets you open/close another frame and a reset button). I'm using one single LocalScript, whos parent is just ScreenGui, and I have this:
sp=Script.Parent
plr=game.Players.LocalPlayer
char=plr.Character
sp.ResetButton.MouseButton1Click:connect(function()
hum=char:findFirstChild("Humanoid")
hum.Health=0
end)
For some reason, this works perfectly fine when the localscript is in the button itself, but it doesn't work when it's outside of the button. For convenience sake, I'd rather be able to manage all the buttons in one script. I remember I did something like this last year and it would work, but of course, so much has changed since then, however I don't know if it's something I'm doing wrong or does the code require something extra for it to function again?

5 comments
line 5 -- FindFirstChild
I've used findFirstChild in a localscript inside the button before, and it still worked, I don't think that made a difference qq
Sorry, I don't think that was me that downvoted you though, this is the first question I asked and I tried to upvote it but it says that I need at least one reputation first.
Must have been someone else.
Yeah, but I thank you so much! It did work, and I appreciate it!