local Icon = require(ReplicatedStorage.Icon)
local IconController = require(ReplicatedStorage.Icon.IconController)
local icon = Icon.new()
icon:setLabel("Teams")
icon.selected:Connect(function()
game.StarterGui.MouseButton1Click:Connect(function()
if game.StarterGui.TeamSwitchGui.MainFrame.Visible == false then
game.StarterGui.TeamSwitchGui.MainFrame.Visible = true
else
game.StarterGui.TeamSwitchGui.MainFrame.Visible = false
end
end)
end)
This is my script, I want it when icon is selected, if the GUI visibility is false, it will show the gui, else, it would make it false.
(Using Topbarplus) I can’t fix this. Nothing appears
I think the problem is that you are changing the Game Gui VIsible, not the Player Gui Visible, to fix the problem, you should write this:
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local playerGui = player.PlayerGui
local mainFrame = playerGui:WaitForChild("TeamSwitchGui"):WaitForChild("MainFrame)
There is no signal called StarterGui.MouseButton1Click and TeamSwitchGui is only active inside PlayerGui
local player = game.Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
icon.selected:Connect(function()
if playerGui.TeamSwitchGui.MainFrame.Visible == false then
playerGui.TeamSwitchGui.MainFrame.Visible = true
else
playerGui.TeamSwitchGui.MainFrame.Visible = false
end
end)