I have a ClickDetector inside a part. I'm using the following script to open a GUI (placed inside the part itself, not the ClickDetector):
script.Parent.ClickDetector.MouseClick:Connect(function(Player)
local pgui = Player:WaitForChild("PlayerGui"
pgui.RefineryGui.Frame.Visible = true
end)
Other info:
- The GUI is placed inside of StarterGui in studio.
- I'm trying to have the GUI open only for the player who clicks the part.
- The GUI contains a button that allows the player to close the GUI. The script I'm using works fine to open the GUI once, but after I close out of it, I can't click the same part to open the GUI again.
Basically, I'm looking for a way to have a player click on a part and have a GUI open (only for the player who clicked the part) that, after it is closed, can be reopened by clicking the part again. Any help is appreciated.
Thank you!

3 comments
http://xyproblem.info
I do agree with incapaxx although I have answered the question, you are asking how to do a lot of things to the point where its just us scripting. I have just told you how to open a GUI with a click detector as thats what the title says.
You forgot a bracket on the end of line 2