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

How to make gui closing button?

Asked by 10 years ago

I used this script to have it close:

1 print ("Close button loaded") 2 3 button = script.Parent 4 window = script.Parent.Parent.Parent 5 6 function onClicked(GUI) 7 window:Destroy() 8 end 9 script.Parent.Mousebutton1Click:connect(onClicked)

I HAVE NO IDEA HOW TO DO IT! (and yes i'm using a textbutton not a textbox

please tell me how to make a gui closing gui or what im doing wrong.

0
uh i didnt see how that would post so the 1 2 3 4 5 6 7 8 9 are different lines itsmedefectiveblocky 0 — 10y

1 answer

Log in to vote
1
Answered by 10 years ago
script.Parent.MouseButton1Down:connect(function() --make sure the script is inside the textbutton
script.Parent.Parent:Destroy() -- do script.Parent.Parent.Parent until you get to the ScreenGui object
end)

Hope I helped!

0
i will try! thanks for helping! itsmedefectiveblocky 0 — 10y
0
it didn't work, WAIT do i put the button on the outter part of the gui? itsmedefectiveblocky 0 — 10y
0
Read the comments in the script. systematicaddict 295 — 10y
Ad

Answer this question