How could I put two values on a global leaderboard

I want to make a global leaderboard but
In my game, once you reach level 20, you can rebirth and get +1 Rebirth and wipe all your levels
When you make a global leaderboard, you can only use 1 datastore and not multiple so how would I make a leaderboard containing the amount of rebirths, and the amount of levels all in the same board?

The highest rebirth in my game is 7 so if i make 1 leaderboard for rebirths, its gonna be problematic since theres gonna be multiple ties and if I make a leaerboard for levels, well your level gets reset whenever you rebirth so what should i do?

3 Likes

You can save a table inside instead of making multiple datastores.

local datastore = DatastoreService:GetDataStore("GlobalLeaderboard")
local success, err = pcall(function()
   datastore:SetAsync({
       ["Level"] = levelNum,
       ["Rebirths"] = rebirthNum
   })
end)
if err then
   error(err)
end

I tried, didnt work
local Data = DataStoreToUse:GetSortedAsync(false, 50, 1, 1e300)
local TopPage = Data:GetCurrentPage()
This is how I get the data to display on the leaderboard

im also using updateasync to set the data

1 Like

Oh, ordered data stores must only store positive integers only… The only solution is to use multiple datastores in order to use OrderedDataStore.