Cannot check if PlayerList is visible

Pressing the Tab key in Roblox shows/hides the PlayerList.

I know how to Enable/Disable the PlayerList, but I don’t know how to check if it is visible or not.

Does anyone know how to check if it is visible?

2 Likes

There is no way to check CoreGui.PlayerList.PlayerListMaster.Visible with scripts unfortunately.

1 Like

There is no way to check when the PlayerList is or is not visible (unless you change it with CoreGuiEnabled, then refer to Cairo’s post). The best solution (what i can think of) is to check with UserInputService if the User presses Tab to hide the PlayerList.

StarterGui:GetCoreGuiEnabled(), this will return a boolean whenever you check for CoreGui.
(not to be confused with StarterGui:SetCoreGuiEnabled())

So you basically say:

StarterGui:GetCoreGuiEnabled(Enum.CoreGuiType.PlayerList)

And you would basically be checking if its visible or not.

1 Like

Currently the only way to check whether the PlayerList is visible is by using UserInputService (like @yoshicoolTV said while I was still typing this :sweat_smile:) like so:

local UserInputService = game:GetService("UserInputService")

local open = true

local function onInputBegan(inputObject, gameProcessedEvent)
	if gameProcessedEvent and inputObject.KeyCode == Enum.KeyCode.Tab then
		if open then
			print("PlayerList is now closed")

			open = false
		else
			print("PlayerList is now open")

			open = true
		end
	end
end

UserInputService.InputBegan:Connect(onInputBegan)

But this method has its flaws as it will only detect if the PlayerList menu is toggled using the Tab key, it won’t detect if the menu is toggled using a mouse

Quote from the docs regarding GetCoreGuiEnabled:

GetCoreGuiEnabled will only change its return value if the PlayerList menu was disabled using the SetCoreGuiEnabled method, not when the menu is toggled by a player unfortunately

I tried this, but it appears to only be Enabled that it is checking.

Try putting this inside your character in a LocalScript:

local StarterGui = game:GetService("StarterGui")
local Status = StarterGui:GetCoreGuiEnabled(Enum.CoreGuiType.PlayerList)
print("STATUS", Status)

Press Play then wait for Roblox to load. Press the Tab key to hide the PlayerList. Now Reset.

It will print true even though the PlayerList is not visible after resetting.

1 Like

I was going to record if the Tab key was pressed by toggling a BoolValue, but as you have said, it won’t work if the player closes the PlayerList with the button.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.