Help with PlayerGui

All of the CoreGuis still remain visible

I don’t think there is anything wrong with my setcoreguienabled, as I am aware of it should only be getting edited inside of that one script.

EDIT: That does work, it seems as the script is having trouble detecting when the menu is visible.

Is your Menu thing visible? If it is then it’ll enable all the CoreGuis, is it invisible by default or visible?

By default it is set to visible

Then there’s nothing wrong with t he code then, it’s jsut doing what it’s told. If the Menu is visible, enable all the coreguis. Try setting All to false to confirm it’s actually changing stuff

Ah, So should I set all the CoreGui’s that I don’t want to see during the menu screen to false?

If that’s what you want then yes, cause right nwo you have

StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, true)

If menu is visible, it’ll enable everything

Here you go it should now work

local StarterGui = game:GetService("StarterGui")
local Main = game.Players.LocalPlayer:WaitForChild("PlayerGui"):WaitForChild("Main")
local Menu = Main:WaitForChild("Menu")

wait()

if Menu.Visible then
	print("set SetCoreGuiEnabled - CoreGuiType all to false")
	StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
else
	print("set SetCoreGuiEnabled - PlayerList all to true")
	StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, true)
	StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, true)
end

Still keeps all CoreGui’s invisible

Change that to

StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, true)

This time all the Gui’s are remaining visible.

What are you trying to do when the Menu is visible?

1 Like

When the Menu is open The Chat, Player Inventory and Leaderboard/PlayerList should remain invisible. Then once a team is selected or the Menu becomes invisible The Chat and Player Inventory should become visible

Then do this?

local StarterGui = game:GetService("StarterGui")
local Main = game.Players.LocalPlayer:WaitForChild("PlayerGui"):WaitForChild("Main")
local Menu = Main:WaitForChild("Menu")

wait()

if Menu.Visible then
	StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, false)
	StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)
	StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
else
	StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, true)
	StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true)
end

The script makes the Backpack, Playerlist and Chat invisible. But I think it is having trouble detecting when the Menu is invisible. Should I set it so that it sets the Menu.Visible to true through another script? Or should I set it like a clicked event so that when the player selects the team and spawns the Guis that I want to become visible become visible again?

Use GetPropertyChangedSignal for that.

1 Like

Use GetPropertyChangedSignal on the Visible property

local StarterGui = game:GetService("StarterGui")
local Main = game.Players.LocalPlayer:WaitForChild("PlayerGui"):WaitForChild("Main")
local Menu = Main:WaitForChild("Menu")

wait()

local function checkVisible()
	if Menu.Visible then
		StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, false)
		StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)
		StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
	else
		print("set SetCoreGuiEnabled - PlayerList all to true")
		StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, true)
		StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true)
	end
end

checkVisible()

Menu:GetPropertyChangedSignal("Visible"):Connect(function()
	checkVisible()
end)
2 Likes

Yes because this will detect only once if the gui is visible or not.

2 Likes

Thank you all very much! The CoreGui’s are now properly working. :slight_smile:

1 Like

Anytime! If you have anymore issues don’t be afraid to make another post!

1 Like