You know how a player can click the buttons at the top of the screen to toggle these gui
Is it possible to show/ hide these manually through a script without just enabling/ disabling a feature altogether?
I have a menu that I want to temporarily hide the chat/ leaderboard for, but don’t want to lock players out from being able to use. I just wanna toggle hide it cause by default it would get in the way.
Hiding/showing the chat is possible through StarterGui:SetCore, but I don’t think the same functionality exists for the leaderboard.
Showing: game:GetService("StarterGui"):SetCore("ChatActive", true)
Hiding: game:GetService("StarterGui"):SetCore("ChatActive", false)
You can still use :SetCoreGuiEnabled(), as this hides the GUI from the players view, yet it can still be active on other screens.
If you want a player to join the game and it is hidden you would put this in a local script:
Disable
game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.Chat, false)
game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)
If you want to enable them for that player again (i’ll be doing it via a key) then do this locally:
Enable
local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.C then
game:GetService(“StarterGui”):SetCoreGuiEnabled(Enum.CoreGuiType.Chat, true)
game:GetService(“StarterGui”):SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, true)
end
end)
I know about this, but as I’m hiding it I want the player to be able to bring them back to visibility through the standard methods (through the top bar)
I’ll look into it for you.
Yeah the player list is a bit tricky since they don’t provide any methods to control that behavior.
It might be possible to detect it indirectly. If you listen for when the user interacts with the region that collapses the playerlist on the topbar and keep track of that state, then you can just use SetCoreGuiEnabled to hide it, and reactivate it when the user tries to interact with that region again.