Axyanz
(Axyanz)
January 14, 2022, 7:03pm
#1
Hello, I am trying to make my guis pop up when the buttons are pressed but there not?
The Prints are showing up.
IT IS IN A LOCAL SCRIPT IN STARTERGUI BY ITSELF
Heres the script:
-- GUI VARIABLES --
local AgentGui = script.Parent.AgentGui
local BattlepassGui = script.Parent.BattlepassGui
local CareerGui = script.Parent.CareerGui
local CollectionGui = script.Parent.CollectionGui
local LobbyGui = script.Parent.LobbyGui
local MainMenuGui = script.Parent.MainMenuGui
local ShopGui = script.Parent.ShopGui
local TopBar = script.Parent.TopSectionGui
print("GUIS LOADED")
-- BUTTON VARIABLES --
local AgentButton = TopBar.TopSection.AgentsButton
local BattlepassButton = TopBar.TopSection.BattlepassButton
local CareerButton = TopBar.TopSection.CareerButton
local CollectionButton = TopBar.TopSection.CollectionButton
local HomeButton = TopBar.TopSection.HomeButton
local PlayButton = TopBar.TopSection.PlayButton
local StoreButton = TopBar.TopSection.StoreButton
print("BUTTONS LOADED")
-- LobbyGui --
PlayButton.MouseButton1Click:Connect(function()
if LobbyGui.Enabled == true then
AgentGui.Enabled = false
BattlepassGui.Enabled = false
CareerGui.Enabled = false
CollectionGui.Enabled = false
MainMenuGui.Enabled = false
ShopGui.Enabled = false
end
end)
print("Lobby Loaded")
-- AgentGui --
AgentButton.MouseButton1Click:Connect(function()
if AgentGui.Enabled == true then
LobbyGui.Enabled = false
BattlepassGui.Enabled = false
CareerGui.Enabled = false
CollectionGui.Enabled = false
MainMenuGui.Enabled = false
ShopGui.Enabled = false
end
end)
print("Agent Loaded")
-- BattlepassGui --
BattlepassButton.MouseButton1Click:Connect(function()
if BattlepassGui.Enabled == true then
LobbyGui.Enabled = false
AgentGui.Enabled = false
CareerGui.Enabled = false
CollectionGui.Enabled = false
MainMenuGui.Enabled = false
ShopGui.Enabled = false
end
end)
print("Battlepass Loaded")
-- CareerGui --
CareerButton.MouseButton1Click:Connect(function()
if CareerGui.Enabled == true then
LobbyGui.Enabled = false
AgentGui.Enabled = false
BattlepassGui.Enabled = false
CollectionGui.Enabled = false
MainMenuGui.Enabled = false
ShopGui.Enabled = false
end
end)
print("Career Loaded")
-- CollectionGui --
CollectionButton.MouseButton1Click:Connect(function()
if CollectionGui.Enabled == true then
LobbyGui.Enabled = false
AgentGui.Enabled = false
BattlepassGui.Enabled = false
CareerGui.Enabled = false
MainMenuGui.Enabled = false
ShopGui.Enabled = false
end
end)
print("Collection Loaded")
-- MainMenu --
HomeButton.MouseButton1Click:Connect(function()
if MainMenuGui.Enabled == true then
LobbyGui.Enabled = false
AgentGui.Enabled = false
BattlepassGui.Enabled = false
CareerGui.Enabled = false
CollectionGui.Enabled = false
ShopGui.Enabled = false
end
end)
print("MainMenu Loaded")
-- ShopGui --
StoreButton.MouseButton1Click:Connect(function()
if ShopGui.Enabled == true then
LobbyGui.Enabled = false
AgentGui.Enabled = false
BattlepassGui.Enabled = false
CareerGui.Enabled = false
CollectionGui.Enabled = false
MainMenuGui.Enabled = false
end
end)
print("Store Loaded")
1 Like
Try setting visible to true?
GUI.Visible = true
Axyanz
(Axyanz)
January 14, 2022, 7:05pm
#3
I do not have a variable called GUI.
Just saying
just change gui to something else like your actually gui
Axyanz
(Axyanz)
January 14, 2022, 7:15pm
#5
I can send a picture of my explorer so you have more info.
I recommend bumping all of that to 1 single UI, from experience this will cause frustration.
Anyways, try redefining your variables to:
game:GetService("Players").LocalPlayer.PlayerGui.GUIHERE
Axyanz
(Axyanz)
January 14, 2022, 7:26pm
#7
so I do this for every one? and I will consider doing that
Axyanz
(Axyanz)
January 14, 2022, 7:31pm
#8
I tried this but it did not work.
-- Main Variables --
local player = game.Players.LocalPlayer
-- GUI VARIABLES --
local playerGui = player:WaitForChild('PlayerGui')
local TopSectionUi = playerGui:WaitForChild('TopSectionGui')
local AgentGui = playerGui:WaitForChild('AgentGui')
local BattlepassGui = playerGui:WaitForChild('BattlepassGui')
local CareerGui = playerGui:WaitForChild('CareerGui')
local CollectionGui = playerGui:WaitForChild('CollectionGui')
local MainMenuGui = playerGui:WaitForChild('MainMenuGui')
local LobbyGui = playerGui:WaitForChild('LobbyGui')
local ShopGui = playerGui:WaitForChild('ShopGui')
print("GUIS LOADED")
-- BUTTON VARIABLES --
local AgentButton = TopSectionUi.TopSection.AgentsButton
local BattlepassButton = TopSectionUi.TopSection.BattlepassButton
local CareerButton = TopSectionUi.TopSection.CareerButton
local CollectionButton = TopSectionUi.TopSection.CollectionButton
local HomeButton = TopSectionUi.TopSection.HomeButton
local PlayButton = TopSectionUi.TopSection.PlayButton
local StoreButton = TopSectionUi.TopSection.StoreButton
print("BUTTONS LOADED")
-- GUI ACTIVATION --
-- LobbyGui --
PlayButton.MouseButton1Click:Connect(function()
if LobbyGui.Enabled == true then
AgentGui.Enabled = false
BattlepassGui.Enabled = false
CareerGui.Enabled = false
CollectionGui.Enabled = false
MainMenuGui.Enabled = false
ShopGui.Enabled = false
end
end)
print("Lobby Loaded")
-- AgentGui --
AgentButton.MouseButton1Click:Connect(function()
if AgentGui.Enabled == true then
LobbyGui.Enabled = false
BattlepassGui.Enabled = false
CareerGui.Enabled = false
CollectionGui.Enabled = false
MainMenuGui.Enabled = false
ShopGui.Enabled = false
end
end)
print("Agent Loaded")
-- BattlepassGui --
BattlepassButton.MouseButton1Click:Connect(function()
if BattlepassGui.Enabled == true then
LobbyGui.Enabled = false
AgentGui.Enabled = false
CareerGui.Enabled = false
CollectionGui.Enabled = false
MainMenuGui.Enabled = false
ShopGui.Enabled = false
end
end)
print("Battlepass Loaded")
-- CareerGui --
CareerButton.MouseButton1Click:Connect(function()
if CareerGui.Enabled == true then
LobbyGui.Enabled = false
AgentGui.Enabled = false
BattlepassGui.Enabled = false
CollectionGui.Enabled = false
MainMenuGui.Enabled = false
ShopGui.Enabled = false
end
end)
print("Career Loaded")
-- CollectionGui --
CollectionButton.MouseButton1Click:Connect(function()
if CollectionGui.Enabled == true then
LobbyGui.Enabled = false
AgentGui.Enabled = false
BattlepassGui.Enabled = false
CareerGui.Enabled = false
MainMenuGui.Enabled = false
ShopGui.Enabled = false
end
end)
print("Collection Loaded")
-- MainMenu --
HomeButton.MouseButton1Click:Connect(function()
if MainMenuGui.Enabled == true then
LobbyGui.Enabled = false
AgentGui.Enabled = false
BattlepassGui.Enabled = false
CareerGui.Enabled = false
CollectionGui.Enabled = false
ShopGui.Enabled = false
end
end)
print("MainMenu Loaded")
-- ShopGui --
StoreButton.MouseButton1Click:Connect(function()
if ShopGui.Enabled == true then
LobbyGui.Enabled = false
AgentGui.Enabled = false
BattlepassGui.Enabled = false
CareerGui.Enabled = false
CollectionGui.Enabled = false
MainMenuGui.Enabled = false
end
end)
print("Store Loaded")
Try printing more, such as when they pressed the button, etc; I don’t know how your game works.
Your print statements are not fully accurate. You could for example rename “StoreLoaded” to “StoreMouseButtonClickEvent loaded”.
I would first suggest putting a print statement after you connect the function to the event. This way, you can see if your button click is being detected.
If your button click is being detected, then the issue is likely with your if statement. If it is not being detected, then it is likely an issue with your buttons.