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

How this script failed?

Asked by 11 years ago
1Frame2 = game.StarterGui.ScreenGui.Frame
2Button = script.Parent
3 
4function onClick()
5    Frame2.Visible = true
6end
7 
8Button.MouseButton1Click:connect(onClick)

What is wrong!?

2 answers

Log in to vote
1
Answered by
Azarth 3141 Moderation Voter Community Moderator
11 years ago

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
02local plr = game.Players.LocalPlayer
03--You may need to fix these
04local Frame2 = script.Parent:WaitForChild("Frame")
05local Button = Frame2:WaitForChild("TextButton")
06 
07function onClick()
08    if Frame2.Visible then
09        Frame2.Visible = false
10    else
11       Frame2.Visible = false
12    end
13end
14 
15Button.MouseButton1Click:connect(onClick)
Ad
Log in to vote
-4
Answered by 11 years ago

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

  1. It may just be the formatting on scriptinghelpers, but to me the computer sees Frame2 as "Frame" "2" not one name of "Frame2"

Hope this helps!

Answer this question