Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How To Make A Text Button Close A Certain GUI?

HI, I'm Tantalingo and I'm currently making a game. In this game, I have a welcome screen with a text button. I want to make it so when the text button is clicked, the GUI isn't shown anymore.

Thank you, .Tantalingo.

I don't have any script currently

5 comments

0

I'm would also like to know how to do this too.

0

Thanks! Ill give that a try!

0

This is not a request site. What have you tried to do? A quick google search could have gone a long way!

0

Thank you for helping everyone!

2 answers

✓ Accepted answer

First, you want to detect if the button has been clicked. You can do this with a function. (Make sure this script is a local script inside the button.)

script.Parent.MouseButton1Click:connect(function()

end)

Next, you want to set the Visible property of the Gui you want to disappear to false.

script.Parent.MouseButton1Click:connect(function()
	local GUI =         --Gui to target here
	GUI.Visible = false
end)

Make sure the variable "GUI" is the Gui you want to disappear when the button is clicked.

K so try this

local button = script.Parent --  Button that u click to close
local Frame = script.Parent.Parent.Frame -- Frame that you want to close

button.MouseButton1Click:Connect(function()
	if Frame.Visible == true then -- If the frame  is visible then...
		Frame.Visible = false -- Make the Frame invisible
	elseif Frame.Visible == false then -- If the Frame is Invisible then..
		Frame.Visible = true -- Make the Frame Visible
end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.