I am trying to disable two GUIs and only load one.. when a button is clicked the previously loaded GUI will disappear/disable and then one other GUI will appear, the same will happen to this one as well, a button clicked will disable that GUI and activate another, then that GUI will disappear and none will be there. The problem I'm having is none of the GUIs disappear whatsoever, they're all still there.
local discla = game.StarterGui.Disclaimer.Disclaimer local Main = game.StarterGui.MainMenu.MainMenu local Note = game.StarterGui.NoteFromJoey.NoteFromJoey Note.enabled = false Main.Enabled = false discla.Enabled = true local button = game.StarterGui.Disclaimer.Disclaimer.TextButton button.MouseButton1Click:Connect(function(plr) discla:Destroy() print("Uh") end) button.MouseButton1Click:Connect(function(plr) Main.Enabled = true end) local play = game.StarterGui.MainMenu.MainMenu.Menu.PlayBTN local Quit = game.StarterGui.MainMenu.MainMenu.Menu.Quit play.MouseButton1Click:Connect(function() Main:Destroy() Note.Enabled = true end) Quit.MouseButton1Click:Connect(function() game.Players.LocalPlayer:kick("Quit Game") end) local old = game.StarterGui.NoteFromJoey.NoteFromJoey.Pages.OldPage old.MouseButton1Click:Connect(function() Note:Destroy() end)
I am VERY new to coding, so I most likely did something wrong, but of course, I do not know what. I have three folders, each of them has its own GUI in it.
In lines 1 to 3, you have var which is led to the gui in startergui but not the guis inside the player. When a player joins, everything in the startergui gets sent to the playergui folder which is inside the player. And :Destroy() destroys an object completely.
local discla = game.Players.LocalPlayer.PlayerGui.Disclaimer.Disclaimer -- Do game.Players.LocalPlayer.PlayerGui local Main = game.Players.LocalPlayer.PlayerGui.Gui.MainMenu.MainMenu local Note = game.Players.LocalPlayer.PlayerGui.NoteFromJoey.NoteFromJoey Note.Enabled = false Main.Enabled = false discla.Enabled = true local button = game.StarterGui.Disclaimer.Disclaimer.TextButton button.MouseButton1Click:Connect(function(plr) discla.Enabled = false print("Uh") end) button.MouseButton1Click:Connect(function(plr) Main.Enabled = true end) local play = game.StarterGui.MainMenu.MainMenu.Menu.PlayBTN local Quit = game.StarterGui.MainMenu.MainMenu.Menu.Quit play.MouseButton1Click:Connect(function() Main.Enabled = false Note.Enabled = true end) Quit.MouseButton1Click:Connect(function() game.Players.LocalPlayer:kick("Quit Game") end) local old = game.StarterGui.NoteFromJoey.NoteFromJoey.Pages.OldPage old.MouseButton1Click:Connect(function() Note.Enabled = false end)