I am curious what is the best way to make a custom leaderboard, like a GUI leaderboard. Are there any methods I can use to get & list players and their stats? What might be the best layout? I am curious to know what might be the best way to do this.
Basically, all you need to know is the players in the game (which can be resolved using PlayerAdded/PlayerRemoved/GetPlayers), and list them in a UI. You can also get special statistics and display those in the UI, by creating and/or viewing them using Lua. Say you want to track kills; every time the 'kills' value is changed, update the player list accordingly.
It is actually quite simple; First you want to create the values, so in a local script put something like this:
repeat wait() until game.Players.LocalPlayer local Plr = game.Players.LocalPlayer if Plr.Leaderboard then--You might need to use find first child, I forgot print "Stats already created" else --Might need to be elseif not Plr.Leaderboard local Values = { "Value1" ,"Value2" } local Stats = Instance.new("Configuration",Plr) --Configurations are more fancy than models Stats.Name = "Leaderboard" for i=1, #Values do local NewStat = Instance.new([ValueType], Stats) --"[ValueType]" is the sort-of value you want, if you want to make each variable have a different value then you make a table inside of a table to decide what value is with what variable. NewStat.Name = Values[i] end
Then you'd make a GUI to display the values, like
game.Players.LocalPlayer.Leaderboard.Value1.Changed:connect(function() script.Parent.Text = game.Players.LocalPlayer.Leaderboard.Value1.Value end)
It is pretty simple. If you need any help, ask.