The problem is that this no longer allows the PlayerList to be shown again (when the player presses TAB).
How is it possible to hide the PlayerList by default in the game but still allow the player to show it whenever they want by pressing TAB?
local Game = game
local UserInputService = Game:GetService("UserInputService")
local StarterGui = Game:GetService("StarterGui")
StarterGui:SetCoreGuiEnabled("PlayerList", false)
local function OnInputBegan(InputObject, GameProcessed)
if GameProcessed then return end
if InputObject.KeyCode.Name == "Tab" then
StarterGui:SetCoreGuiEnabled("PlayerList", true)
end
end
local function OnInputEnded(InputObject, GameProcessed)
if GameProcessed then return end
if InputObject.KeyCode.Name == "Tab" then
StarterGui:SetCoreGuiEnabled("PlayerList", false)
end
end
UserInputService.InputBegan:Connect(OnInputBegan)
UserInputService.InputEnded:Connect(OnInputEnded)
Or press to toggle?
local Game = game
local UserInputService = Game:GetService("UserInputService")
local StarterGui = Game:GetService("StarterGui")
StarterGui:SetCoreGuiEnabled("PlayerList", false)
local function OnInputBegan(InputObject, GameProcessed)
if GameProcessed then return end
if InputObject.KeyCode.Name == "Tab" then
StarterGui:SetCoreGuiEnabled("PlayerList", not StarterGui:GetCoreGuiEnabled("PlayerList"))
end
end
UserInputService.InputBegan:Connect(OnInputBegan)