Hello, I am trying to make this script print the top 10 players with the most "Fans" so I can then make it display on a leaderboard within my game. I have been trying for a while now and I am confused. It only prints my name and my fans then it prints my userId and the number 1? I haven't told the script to even print my fans because I don't know how to do that so I am very confused. Any ideas?
local DataStoreService = game:GetService("DataStoreService")
local characterAgeStore = DataStoreService:GetOrderedDataStore("Savesss")
local pages = characterAgeStore:GetSortedAsync(false, 10)
while true do
local data = pages:GetCurrentPage()
for _, entry in pairs(data) do
print(entry.key .. ":" .. tostring(entry.value))
end
if pages.IsFinished then
break
end
end

2 comments
use an ordered datastore
and How do I do that?