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

How Do I Make A Closing Screen Gui Script?

Asked by 4 years ago
Edited 4 years ago

I'm Making A Game, And I Made A Menu GUI. I Added An X Button, And I Don't Know The Script To Close It. Little Help Please..? This Is The Script I Tried From Some Other Post, But It Doesn't Work.

button = script.Parent
2   function onClicked()
3   if button.MouseButton1Click
4   then button.Visibile = false -- this only removes the button how do i get it to remove everything else
5       end
6   end
7   button.MouseButton1Click:connect(onClicked)

What Is The Script I Should Use??

0
;-; Or1g1nal_Player 22 — 4y
0
just tell the gui to delete from player gui after the x is pressed :/ MrDefaultMan 113 — 4y
0
just tell the gui to delete from player gui after the x is pressed :/ MrDefaultMan 113 — 4y
0
And... How Do I Do That? Or1g1nal_Player 22 — 4y
View all comments (5 more)
0
How.. Or1g1nal_Player 22 — 4y
0
either do this: (whatever the fullname of the screengui is):Delete() after x is clicked. or tell it to move somewhere else like make it a member of lighting (lighting is a good landfill for things like models or guis that you want to load in at certain times) MrDefaultMan 113 — 4y
0
:Destroy() MrDefaultMan 113 — 4y
1
maybe because you spelt visible wrong Arkrei 389 — 4y
0
^ Lmao. FadedJayden_Dev 118 — 4y

3 answers

Log in to vote
0
Answered by 4 years ago
button = script.Parent
   function onClicked()
   if button.MouseButton1Click
   then button.Visibile = false

script.Parent:Remove()

 end
 button.MouseButton1Click:connect(onClicked)
0
you also need to remove screen TomAndelson 258 — 4y
0
maybe because visible is spelt wrong Arkrei 389 — 4y
0
script.Parent is the button not the GUI. You will need to delete the GUI, I assume it could be script.Parent.Parent:Destroy() Torren_Mr 334 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

epic not fail

button = script.Parent
   function onClicked()
   if button.MouseButton1Click
   then button:Remove()
else
       end
   end

   button.MouseButton1Click:connect(onClicked)

no local script

Log in to vote
0
Answered by 4 years ago

I would prefer the store the Menu GUI and the x button under the same Screen GUI as Screen GUIs have a property, Enabled. So you can disable it on a click of a button.

button = script.Parent
notclicked = true

function OnClicked()

        script.Parent.Parent.Enabled = false
    end

script.Parent.MouseButton1Down:Connect(function(OnClicked)

Both the Menu GUI and Button is nested under a Screen Gui.

Answer this question