First off Here's the 'game' [[[[[StarterGui, [[[[PIXL EDITOR, [[[Page1, -- A frame [[TextButton, -- A TextButton that says "Page 2" [Script1, -- A script]]] [[[Page2, -- A frame [[TextButton, -- A TextButton that says "Page 1" [Script2, -- A script]]] (I put a [ on each child and a ] to show it's the last child in that main parent) Script1:
local screen = game.StarterGui["PIXL EDITOR"] local model = script.Parent.Parent local Page2 = screen.Page2 script.Parent.MouseButton1Down:connect(function() wait(1) Page2.Visible = true Page2.TextButton.Active = true for _,v in pairs(Page2:GetChildren()) do v.Visible = true end model.Visible = false model.TextButton.Active = false for _,v in pairs(model:GetChildren()) do v.Visible = false end end)
Script2:
local screen = game.StarterGui["PIXL EDITOR"] local model = script.Parent.Parent local Page1 = screen.Page1 script.Parent.MouseButton1Down:connect(function() wait(1) Page1.Visible = true Page1.TextButton.Active = true for _,v in pairs(Page1:GetChildren()) do v.Visible = true end model.Visible = false model.TextButton.Active = false for _,v in pairs(model:GetChildren()) do v.Visible = false end end)
(The buttons are on the right of the screen in the same spot, but Page1.Visible is false and Page1.TextButton.Active is false while Page2 and it's TextButton have the properties set to true) When you spawn in, you see the button that says "Page 1" on the right, when you click it all GUIs are invisible. if I don't reply within 24 hours follow me on roblox and send me some sort of message reminding me of this question please. P.S. PIXL EDITOR is a gui editor plugin so I can't rename that.
You're changing everything in the StarterGui instead of the PlayerGui, so nothing is happening. In order to solve this problem, change it to:
local screen = script.Parent.Parent.Parent -- This should grab the local player's GUI instead of the game's GUI
In addition, you don't need to get the children of the frame visible. All you need to do it make the frame invisible and all of its children will be invisible as well. You don't need to deactivate the buttons either.
I'd suggest putting in a debounce for this script as well, considering you're waiting a second. This prevents people from clicking the buttons tons of time causing some errors to occur. In order to do this, simply add in a variable named something like, debounce = false`` When you're done doing so, you can easily change the debounce to true when you click and have a conditional (
if debounce == false then') statement to check if it's been triggered yet. Once it goes through the whole function, do debounce = false
If you're unsure of what I'm talking about, you can read the wiki's page about it here: http://wiki.roblox.com/index.php?title=Debounce