Checking if the player list was manually closed

Using ContextActionService, when the PlayerList core GUI is enabled, tab will never fire as Enum.UserInputType.Begin.

I have tried setting up the input at a higher priority than the Core GUI (normally 2000) but that does not seem to make a difference.

local tabToggled = true
local function tabToggle(_, inputState)
	print(inputState) -- always Enum.UserInputState.End or Enum.UserInputState.Cancel when the Core GUI Enum.CoreGuiType.PlayerList is enabled
	if inputState == Enum.UserInputState.Begin then -- does not run
		tabToggled = not tabToggled
		print(tabToggled)
	end
end

ContextActionService:BindActionAtPriority("tabToggled", tabToggle, false, 3000, Enum.KeyCode.Tab)

This function will only ever change the value of tabToggled when the playerlist is disabled using StarterGui:SetCoreGuiEnabled("PlayerList", false), since that seems to be the only time inputState is ever Enum.UserInputState.Begin. Unfortunately, that is not ideal for me since I am writing this code to keep track of whether or not the player list was closed (so that I don’t reopen it later in scripts if the player has manually closed it), so the player list must be enabled when this code runs.

Is there any other easy way to go about checking if the player manually closes the tab menu? The tab menu is disabled and reenabled at certain points in my game, and I don’t wish for it to reenable itself when the player has closed it previously.

The PlayerList is located in CoreGui, simply check if PlayerListMaster has Visible to false (false means it’s disabled):
image

I’m getting the error “The current identity (2) cannot Class security check (lacking permission 1)” when I try to check CoreGui.PlayerList.PlayerListMaster.Visible