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 5 years ago
Edited 5 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.

1button = script.Parent
22   function onClicked()
33   if button.MouseButton1Click
44   then button.Visibile = false -- this only removes the button how do i get it to remove everything else
55       end
66   end
77   button.MouseButton1Click:connect(onClicked)

What Is The Script I Should Use??

0
;-; Or1g1nal_Player 22 — 5y
0
just tell the gui to delete from player gui after the x is pressed :/ MrDefaultMan 113 — 5y
0
just tell the gui to delete from player gui after the x is pressed :/ MrDefaultMan 113 — 5y
0
And... How Do I Do That? Or1g1nal_Player 22 — 5y
View all comments (5 more)
0
How.. Or1g1nal_Player 22 — 5y
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 — 5y
0
:Destroy() MrDefaultMan 113 — 5y
1
maybe because you spelt visible wrong Arkrei 389 — 5y
0
^ Lmao. FadedJayden_Dev 118 — 5y

3 answers

Log in to vote
0
Answered by 5 years ago
1button = script.Parent
2   function onClicked()
3   if button.MouseButton1Click
4   then button.Visibile = false
5 
6script.Parent:Remove()
7 
8 end
9 button.MouseButton1Click:connect(onClicked)
0
you also need to remove screen TomAndelson 258 — 5y
0
maybe because visible is spelt wrong Arkrei 389 — 5y
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 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

epic not fail

1button = script.Parent
2   function onClicked()
3   if button.MouseButton1Click
4   then button:Remove()
5else
6       end
7   end
8 
9   button.MouseButton1Click:connect(onClicked)

no local script

Log in to vote
0
Answered by 5 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.

1button = script.Parent
2notclicked = true
3 
4function OnClicked()
5 
6        script.Parent.Parent.Enabled = false
7    end
8 
9script.Parent.MouseButton1Down:Connect(function(OnClicked)

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

Answer this question