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

Script that is supposed to make a separate GUI pop up if a TextButton is clicked doesn't work, why?

Asked by 6 years ago

So I'm making a tutorial for my game that will pop up whenever someone joins the game. There is a question "Would you like a tutorial?" and then two choices. Yes or No. If No is clicked, the GUI closes and that works fine. However, if Yes is clicked, it is supposed to bring up the second tutorial GUI and close the first GUI. (The Tutorial is made up of a series of GUIs with text) The Yes button closes the first GUI but does not open the second. Why not? My code was: ``script.Parent.MouseButton1Click:connect(function() script.Parent.Parent.Visible = false game.Workspace.StarterGui.TutorialGui2.Frame.Visible = true end)

1 answer

Log in to vote
0
Answered by 6 years ago

you have to target the playergui, so if your in a local script do game:GetService"Players").LocalPlayer:WaitForChild("TutorialGui2") and so on .

0
The new script is: sesamert16 31 — 6y
0
Woops. Hit enter way to early there. My new script is script.Parent.MouseButton1Click:connect(function() script.Parent.Parent.Visible = false game:GetService("Players").LocalPlayer:WaitForChild("TutorialGui2").Frame.Visible = true end) but still the first GUI only closes and the second GUI is not made visible. sesamert16 31 — 6y
0
Nevermind, I solved it on my own. You forgot to put PlayerGui in between LocalPlayer and WaitForChild. sesamert16 31 — 6y
0
Oh yea sorry 1000anton 38 — 6y
Ad

Answer this question