Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

GUI Not closing when button clicked, help please?

Asked by 7 days ago

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

Log in to vote
0
Answered by
sheepposu 127
7 days ago
Edited 7 days ago

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

0
You can also do coolor stuff with script.Parent.Parent:TweenPosition sheepposu 127 — 7d
0
no, it isn't. moving it offscreen is not the best solution. set the screengui/frame object visiblity to false/true. Fifkee 886 — 7d
Ad
Log in to vote
0
Answered by 7 days ago

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

Answer this question