I’m trying to make a leaderboard system, but for some reason it isn’t working. I have printed entries and it returns an empty dictionary, so I think it has to do with retrieving credits.
local datastore = game:GetService("DataStoreService")
local playerCredits = datastore:GetOrderedDataStore("credits")
local pages = playerCredits:GetSortedAsync(false, 25)
local entries = pages:GetCurrentPage()
for index, entry in pairs(entries) do
print(index .. "-" .. entry.key .. "-" .. entry.value)
end
going back to @4kdvn’s previous, unanswered question, is there anything saved in the creditsOrderedDataStore? It’s important to note that OrderedDataStores are separate from standard DataStores.
Yes; OrderedDataStores are separate to DataStores. Don’t bother putting as much security when saving it, a simple SetAsync in a pcall should work as it’s only meant to mimic already existing data.
Save to the ordered data store as well when you save data normally.