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

GUI Not closing when button clicked, help please?

Hello! I have a GUI menu that has a button that's supposed to closed the GUI when clicked. However, on click, nothing happens. Here's the code.

function close()
script.Parent.Parent.Visible = false
end

script.Parent.MouseButton1Click:connect(close)

Thanks in advance!

2 answers

✓ Accepted answer

Try this

function close()
	script.Parent.Parent.Position = UDim2.new(0, 0, -5, 0)
end

Simply changing the position to be off the screen is usually the best solution

2 comments

0

You can also do coolor stuff with script.Parent.Parent:TweenPosition

0

no, it isn't. moving it offscreen is not the best solution. set the screengui/frame object visiblity to false/true.

You can try making the gui first and put it on replicated storage, then clone it to playergui when opened and destroying it when closed

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