How can I make a global leaderboard with over 100 slots?

Hello! I played the game Bedwars today and saw that they have a new update. The update is a monthly wins leaderboard. Now, we all have heard of global leaderboards I am assuming. And it isn’t that hard to make a monthly one. But what makes this leaderboard so unique is that it can have more than 100 players.

Now, this leaderboard isn’t the typical physical one that you see in simulators. This is a GUI that shows your rank after you win a round.

I am wondering how this game made this system, and how I could make a similar system. Here are some thoughts about this that have come to my mind:

It probably doesn’t use the normal OrderedDataStore;
It might need to be monthly because of all the data it is handling, it couldn’t render an all-time leaderboard;
It might be using an external server to store the data;

I have searched all over the DevForum and have found nothing on this topic. Would there be a way that I could do this, and what would I need to do to achieve this.

My guess is that it is using an external server to store and load data, but I could be wrong. Thanks for any help.

1 Like

Data stores are slow but if you don’t have experience in HTTPS then it’s an option

1 Like

For future reference you shouldn’t search on devfourm for specific information like this. Just use the roblox wiki. I’m pretty sure they state that you can only have a 100 page maximum, but that doesn’t mean you can’t create over a 100 player leaderboard. It just means you’d most likely have to cycle through the pages to get those next players. Usually when I make ordered data stores ill use either a 10 or 50 page maximum and cycle to the next page to get those players if I have a higher request. So you could probably pull off 500 if you wanted to. I don’t think its impossible, but would cause some serious lag if you were attempting to update it too frequently. When I do 50 player leaderboards I usually will update it every 5 minutes.

1 Like

This would be really slow. I wanted to know how I could make a system that wouldn’t take 10 years. Because of limits, to sort through over a million players it would take forever.

I do not have experience in HTTPS, but this would be much faster than data stores. Do you know any way I could do this using HTTPS?

It actually wouldn’t take forever lol. What makes you think it would take forever > theres limits but you can easily set a timer to offset the limitations. Like what?

Actually if anything using HTTPS would take longer. ODS is a service created literally for this. Doing it on your own could cause way more lag or longer wait times than just using ods to begin with. Don’t go around assuming things are better without any actual information.

You can indeed use OrderedDataStore. When you use OrderedDataStore:GetSortedAsync(), it returns a Pages object which contains an order of the rankings. Normally you would just use Pages:GetCurrentPage(), but there is a method (Pages:AdvanceToNextPageAsync()), which will basically go to the next page, so when you call Pages:GetCurrentPage() again, it will have the next 100 players in the OrderedDataStore, you should just check the documentation. Hope this helps!

OrderedDataStore
DataStorePages

Also you can maybe use os.date() for something like that to name your OrderedDataStore with months so you don’t need to manually change the OrderedDataStore every month.

I am saying that it would take forever with over one million players to sort through.

How so? you’re not making a million player leaderboard are you? If you’re making a million player leader board its going to take forever to do with anything on roblox. Roblox doesn’t have that powerful of an engine anything you use to account for a million players is already by default going to take a long time.

I want to. Bedwars does it this way, I want to know how I can load hundreds of thousands of data, or find the users rank. In this case, having a separate server for data would make it so much faster as it can search and put the user where they fit.

Well ods is still the best way to do this. Https/messaging service would just cause a ton of un-necessary lag. Those services aren’t meant for such heavy duty work such as this. Aside from that ods is way easier to use and you’d have less of a chance messing it up. Much more user friendly.

What do you mean? All that would be sent is one string, two times. Sending it to the server, getting a result there, and sending the result.

Lmao I’m not even gonna explain it. Why don’t you go ahead and try it c: see what happens.

I already made it, and it works lol. It works in a server with 20+ players just fine. No lag at all.

i have a script like that but its for a time played in the game i hope this helps you could change some things if you need it but this is what i got

local sg = script.Parent
local sample = script:WaitForChild(“Sample”)
local sf = sg:WaitForChild(“ScrollingFrame”)
local ui = sf:WaitForChild(“UI”)

local dataStoreService = game:GetService(“DataStoreService”)

local dataStore = dataStoreService:GetOrderedDataStore(“Leaderboard”)

wait(10)
while true do
for i,plr in pairs(game.Players:GetChildren()) do
if plr.UserId>0 then
local w = plr.leaderstats.Time.Value
if w then
pcall(function()

				dataStore:UpdateAsync(plr.UserId,function(oldVal)
			     
					return tonumber(w)
				end)
			end)
		end
	end
end    
local smallestFirst = false
local numberToShow = 100
local minValue = 1
local maxValue = 10e30
local pages = dataStore:GetSortedAsync(smallestFirst, numberToShow, minValue, maxValue)

local top = pages:GetCurrentPage()
local data = {}
for a,b in ipairs(top) do
	local userid = b.key
	local points = b.value
	local username = "[Failed To Load]"
	local s,e = pcall(function()
	 username = game.Players:GetNameFromUserIdAsync(userid)
	end)
	if not s then
	   warn("Error getting name for "..userid..". Error: "..e)
	end
	local image = game.Players:GetUserThumbnailAsync(userid, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size150x150)
	
	table.insert(data,{username,points,image})
end
ui.Parent = script
sf:ClearAllChildren()
ui.Parent = sf
for number,d in pairs(data) do
	local name = d[1]
	local val = d[2]
	local image = d[3]
	local color = Color3.new(1,1,1)
	if number == 1 then
		color = Color3.new(1,1,0)
	elseif number == 2 then
		color = Color3.new(0.9,0.9,0.9)
	elseif number == 3 then
		color = Color3.fromRGB(166, 112, 0)
	end
	local new = sample:Clone()
	new.Name = name
    new.LayoutOrder = number
	new.Image.Image = image
	new.Image.Place.Text = number
	new.Image.Place.TextColor3 = color
	new.PName.Text = name
	new.Value.Text = val
	new.Value.TextColor3 = color
	new.PName.TextColor3 = color
	new.Parent = sf
end
wait()
sf.CanvasSize = UDim2.new(0,0,0,ui.AbsoluteContentSize.Y)

wait(90)

I doubt that c; Because if it worked you wouldn’t be here asking your dumb question for everyone to help you.

I got my answer yesterday, and I made a solution. Do you think I’m dumb?

1 Like

will this work for you or no

thats the part that i made it work with that manny

I mean yeah, you’re asking how to solve your problem on the devfourm instead of finding out yourself. How are you ever gonna become good at scripting if you always ask for help. How pathetic is that lmao.

thank you i really hope i helped you out with that a bit that is a time leaderboard with a max of 100 robloxians on it