A way to get and set the shown/hidden state of leaderstats

As a Roblox developer, it is currently too hard to determine and alter the shown/hidden state of leaderstats. Currently our main method through scripting to show/hide leaderstats is to use StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, true/false).
And StarterGui:GetCoreGuiEnabled(Enum.CoreGuiType.PlayerList) will only get this value.
Consider the following operations:

1. StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, true)
2. StarterGui:GetCoreGuiEnabled(Enum.CoreGuiType.PlayerList) -- returns true
3. player press tab to hide the leaderstats
4. StarterGui:GetCoreGuiEnabled(Enum.CoreGuiType.PlayerList) -- still returns true

5. StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)
6. StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, true) -- this also show the leaderstats

So apparently, besides the ‘Enabled’ property, there is a hidden ‘Visible’ property for leaderstats. However the Visible property is also affected by setting ‘Enabled’

-- current apparent behaviour
PlayerList.Enabled = true -- initial states usually
PlayerList.Visible = true

-- on press tab
PlayerList.Visible = false
print(StarterGui:GetCoreGuiEnabled(Enum.CoreGuiType.PlayerList)) -- returns true because PlayerList.Enabled is still true

StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)
-- equivalent to:
-- PlayerList.Enabled = false
-- PlayerList.Visible = false

StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, true)
-- equivalent to:
-- PlayerList.Enabled = true
-- PlayerList.Visible = true
-- side effect: it is made visible, although player had it hidden

If Roblox is able to address this issue, it would improve my development experience because duration cutscenes, it is advised to hide the leaderstats like so:
https://create.roblox.com/docs/players/leaderboards#hide-the-leaderboard

after the cutscene, we would want to restore the leaderstats state to before, including the Visible state

4 Likes

this would be a super useful feature that improves user experience across so many games. Does Roblox need to re-initialize the playerList every time the CoreGui is toggled? It shouldn’t be super hard to implement this, or at least as a new function of StarterGui for Showing and Hiding core GUIs without needing to completely Enable/Disable them so they don’t need to be re-initialized.

Something like StarterGui:SetCoreGuiVisible(enum.CoreGuiType, boolean)
and it would change the visibility of the Frame without being a function that completely disables/re-enables the whole system.

Easy-peasy implementation, can be done by a single engineer in 5-10 minutes probably and would make a substantial improvement for player experience across many games.

1 Like