I want to toggle the roblox’s leaderboard hidden by default when the player spawns, like how players are able to toggle it by pressing “tab”
There’s the solution of hiding the CoreGui by simply disabling it and enabling it, but I don’t want to disable it I just want the leaderboard to be toggled hidden by default.
Hello! Unfortunately, I don’t believe this to be possible. However, there is a work around. While it isn’t perfect, you can put the following code in StarterPlayerScripts:
local sgui = game:GetService("StarterGui")
local UserInputService = game:GetService("UserInputService")
sgui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false) -- completely disables playerlist when the player first joins
UserInputService.InputBegan:Connect(function(input, gpe)
if gpe then
return
end
if input.KeyCode == Enum.KeyCode.Tab then -- detects if player presses tab
sgui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, true) -- re-enables playerlist
end
end)
This kind of works, but there are definitely some issues with it. Players on tablet will have no way of re-enabling the playerlist, and computer players can’t re-enable it in the three dots menu in the top right corner. You probably could make a custom GUI to allow tablet players to re-enable it, but that is a little bit clunky. If possible, the best solution would probably be to make a custom leaderboard instead. This does work if you can’t or don’t want to make a custom leaderboard if you are okay with it’s drawbacks!
Edit: I just remembered that Roblox added leaderboards to phones a little while ago. It would probably be good to check if the player is on phone and enable the leaderboard if they are. The phone leaderboard is opened up in the three dots menu so it’s basically already hidden by default!
You’ve done a very good job summarizing the problem, possible solutions, and the issues with each solution. I just wish there was a simple solution to a simple problem. Especially since, as you stated, the cell phone interface is already hidden by default. Thank you for your help.