Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

GUI Not closing when button clicked, help please?

Asked by 5 years 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 561 Moderation Voter
5 years ago
Edited 5 years 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 561 — 5y
0
no, it isn't. moving it offscreen is not the best solution. set the screengui/frame object visiblity to false/true. Fifkee 2017 — 5y
Ad
Log in to vote
0
Answered by 5 years 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