Simple print leaderboard doesn't work?

I am trying to print simple leaderboard in output, but it seems doesn’t give me ant pages or something, did i forget something? i did enable apis and i do have data in my data store manger

code

local DataStoreService = game:GetService("DataStoreService")
local pointsStore = DataStoreService:GetOrderedDataStore("PlayerData")

local function printTopTenPlayers()
	local isAscending = false
	local pageSize = 10
	local pages = pointsStore:GetSortedAsync(isAscending, pageSize)
	local topTen = pages:GetCurrentPage()
	print(topTen)
end

printTopTenPlayers()

i have another script that saves data with SetAsync
Data structure

local dataToSave = {
	Cash = Number
	Level = Number
	Items = Number
}

My way to save data:

local success, errorMessage = pcall(function()
		playerDataStore:SetAsync(userId, dataToSave)
end)

Hey!

For GetOrderedDataStore, you can’t save tables directly.

only works with numbers

1 Like

As the person above said, GetOrderedDataStore only works with numbers (and maybe strings I haven’t tested)
It doesn’t work with tables due to the reason that tables aren’t really comparable, since :GetSortedAsync() sorts in an identical way table.sort does, except you can’t change the comparison function

1 Like

Sadly, it doesn’t work with strings Aswell.

Only numbers are supported

1 Like

Makes you wonder why they don’t simply allow you to provide a sorting function like they do with table.sort.

1 Like

For those who wonder why it didn’t work it was my mistake :slightly_smiling_face: , i was saving to Data Store instead Ordered Data Store…