How do I hide the player list without disabling it?

So basically I am making a 2D game. When the game starts I want the player list to automatically hide, but the player can still press tab to show it if they want.

I have starter gui defined in a variable called “StarterGui.” Please help me make the script?

1 Like

Well you could maybe make it disabled on default, then when the player presses Tab, it can be enabled?

You could also try this:

Yeah that’s what I literally said I wanted in the post. Also I have seen that topic before and it didn’t work for me.

Well I don’t believe there is any api that makes it hidden when called without disabling it. The only other thing I can think of is to make a custom player list by disabling the default one entirely and making the custom one work the way you want it.

1 Like

Disable it by default, or keep it enabled. When it needs to be disabled, disable it. When the player presses TAB, toggle it with SetCoreGuiEnabled & GetCoreGuiEnabled.

Building on from pos0’s reply, it’d look something like this

local StarterGui = game:GetService('StarterGui')
local UIS = game:GetService('UserInputService')

StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false) -- hides the leaderboard by default

UIS.InputBegan:Connect(function(Input)
	if Input.UserInputType == Enum.UserInputType.Keyboard then
		if Input.KeyCode == Enum.KeyCode.Tab then -- checks if tab button was pressed
			local Status = StarterGui:GetCoreGuiEnabled(Enum.CoreGuiType.PlayerList) -- gets the current status of the leaderboard

			StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, not Status) -- hides or shows it depending on status
		end
	end
end)

Edit:

Make sure to read the docs and understand what everything above does if you’re going to use it.
Checking if the user pressed the tab: UserInputService
Enabling/disabling the leaderboard: StarterGui:SetCoreGuiEnabled

2 Likes