New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
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 3 months 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 391 Moderation Voter
3 months ago
Edited 3 months 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 391 — 3mo
0
no, it isn't. moving it offscreen is not the best solution. set the screengui/frame object visiblity to false/true. Fifkee 1025 — 3mo
Ad
Log in to vote
0
Answered by 3 months 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