So im needing to make a “leaderboard” system that displays everyones stats very quickly (just in one server) currently I am using Ordered Datastores but these take to long to update/change (6 seconds between sending.) and i need the “leaderboarding” done in like 1 second.
So im wondering how the Core-GUI’s leaderboard does it. Please help!
I usually manage all stats in a table server side. Every time a user stat is updated and checked for validity the leaderboard stat is changed. Here’s a great article on leaderboards.
Here’s the type of table I use to store data.
You seem to know datastore, I save the players data every x seconds and when they leave. I simply load the table data if their datastore exists.
thats not my issue my issue is i need to know how the leaderboard finds the player with the most KO’s (or something) else ranks them first, finds the second person, ranked them second etc.
It takes a list of all players in the server and their corresponding stats, and then sorts them according to one of those stats. It’s not cross-server and it doesn’t use datastores.
wait(2)
local data = {}
for i,x in pairs(game.Players:GetPlayers()) do
table.insert(data,x.Name)
end
for i,x in pairs(data) do
x = math.random(1,3)
end
table.sort(data)
for i,x in pairs(data) do
print(x)
print(data[x])
end
so this is the code I have but instead it makes it so the person with the most gold goes second and the person with less gold goes first and sometimes the second player is labeled as “nil”