1 | Frame 2 = game.StarterGui.ScreenGui.Frame |
2 | Button = script.Parent |
3 |
4 | function onClick() |
5 | Frame 2. Visible = true |
6 | end |
7 |
8 | Button.MouseButton 1 Click:connect(onClick) |
What is wrong!?
StarterGui is where you put GUI's that will replicate to the player's PlayerGui. You edit the GUI in PlayerGui to display any changes instantly.
01 | -- LocalScript in the ScreenGui |
02 | local plr = game.Players.LocalPlayer |
03 | --You may need to fix these |
04 | local Frame 2 = script.Parent:WaitForChild( "Frame" ) |
05 | local Button = Frame 2 :WaitForChild( "TextButton" ) |
06 |
07 | function onClick() |
08 | if Frame 2. Visible then |
09 | Frame 2. Visible = false |
10 | else |
11 | Frame 2. Visible = false |
12 | end |
13 | end |
14 |
15 | Button.MouseButton 1 Click:connect(onClick) |
Several Things that might brake the script...
1. I am not positive, but "MouseButton1Click" may be wrong. Even if it is technically correct, try something like MouseButton1Down
2. Try messing around when the arguments in the function. A variable might not be carrying over
Hope this helps!