Help With Close button

I did this in my game :upside_down_face:

This is your issue, change it to this


local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Frame.Visible = false
end)

Boom just put this exact code in instead of your own, and I am 99% sure it will work!

And just a tip, you would only ever need to reference the playerGui if it is from a normal script in the server, if it is a local script, just do start referencing from the script, as in like script.Parent bla bla bla

It only needs to be done on the client end. If you change it with a server script its just replicating to the client as a normal local script would, just slightly slower. I’d probably change that if I were you, unless it for some strange reason only works that way.

But this is kind of off topic…

Question for the OP, does anything come up in the output? Is there an error? There’s too many possible things wrong with your script. Can you send a screenshot of the explorer as well?

Try this script:

local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Frame.Visible = false
end)

I think you made a small mistake in reading mine. It says it works fine, np though.
So what you are saying is to add the button to the frame so that as my frame goes invisible the button does as well(if I am not wrong)
But I want that as I click the button only the frame goes invisible and it is working fine.
eg:
https://gyazo.com/a923cacdb5c56126b3dce997967e51bc

1 Like