1 | StartButton = game.Workspace.StarterGui.Start |
2 | back = game.Workspace.StarterGui.ScreenGui |
3 |
4 | function MouseClick(Start) |
5 | Start:Destroy() |
6 | back:Destroy() |
7 | end |
8 |
9 | script.Parent.Click:connect(MouseClick) |
when you click the StartButton, it destroys the back and the startbutton. But, it won't work! D: Why?
01 | StartButton = game.StarterGUI.ScreenGUI.Start |
02 | back = game.StarterGUI.ScreenGUI |
03 |
04 | function MouseClick(Start) |
05 |
06 | start:Destroy() |
07 | back:Destroy() |
08 |
09 | end |
10 |
11 | script.Parent.MouseButton 1 Click:connect(MouseClick) |
12 |
13 | -- want to return the gui after? well here you have it |
14 | wait( 3 ) |
15 | return gui |
try this
1 | gui = game.StarterGUI.ScreenGUI -- declare the gui |
2 | gui.start.MouseButton 1 Down:connect( function () -- call a function that checks if the button was clicked |
3 | gui:Destroy() --destroys the whole gui in one shot |
4 | end ) |