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

How to make a Gui Exit Button?

How would I make a button that closes a Gui? I have a Welcome Gui and a Button but not sure how to make the Button do something. All help is appreciated, thanks. :)

2 answers

Put this script inside of a button that is inside of a Gui Frame. The frame should also include all Gui elements such as text and images.

local button = script.Parent
local frame = button.Parent

button.MouseButton1Click:connect(function()
frame.Visible = false
end)

What Mowblow posted would work (assuming your hierarchy was set up accordingly), but I'd save lag by just destroying the whole GUI instead of just making it invisible, unless of course you need to re-open it later.

local btn = script.Parent
local frame = btn.Parent

btn.MouseButton1Click:connect(function()
	frame:Destroy()
end)

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