How would I close a GUI just using a TextButton?
There's a huge problem with your question.
This is not a request site.
I'm going to answer the question the best I can, but you might find this slightly unhelpful due to the broadness of your one sentence question. You have no code, no details, and provided no evidence of you trying the problem yourself. However, I'm in a good mood. Let's dive in with your question.
Because you're asking this question, I'm assuming you already have some sort of knowledge on GUIs. So I wont go too much into them. When working with GUIs however, it's important to remember that everything gets replicated
from the StrarterGui
. So when trying to access the Player's specific GUI, you can't access it with the StarterGui. You have to do so using the PlayerGui
, located in every player.
Scripts, or more specifically Server Sided Scripts, can not access the PlayerGui with Filtering Enabled
. I make all my answers compatible with Filtering Enabled so if you don't know what that is, here's a few links to videos and wiki articles about Filtering Enabled,
Youtube Video, by Pea'sFactory
"Should I use Filtering Enabled" By Script Guider.
And Here's ScriptGuiders Profile here.
Great. Now that you know what filtering enabled it, lets move onto your question. You can write Scripts, or in this case LocalScripts
into GUIs in the StarterGui. The LocalScripts
wont run until the scripts get Replicated to the player. This is a good thing. Now, I'm assuming you know how to open the GUI because your question asks, "How would I close a GUI just using a TextButton?". So, Lets run down a hypothetical Parent-Child setting here. Let's say the ScreenGui
is inside of the player's PlayerGui
, and that the Frame
,or whatever you're trying to close, is inside of the ScreenGui
. For simplicity lets also assume that the TextButton
is also inside of the ScreenGui
. You would need to insert a LocalScript
into the text button. The LocalScript should read similar to this,
script.Parent.MouseButton1Down:connect(function()---Mouse Click Event connected to a function script.Parent.Parent:FindFirstChild("Frame").Visible = false--Sets the Frame's Visible property to false script.Parent.Visible = false-- same thing but to the text button end
PlayerGui-->ScreenGui-->Frame, TextButton-->LocalScript
There isn't a Visible property to ScreenGuis, as these are meant for folders, not visible objects on the Player's Screen.
Thank you, Good Luck.
Closed as Not Constructive by Shawnyg
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?