Datastore not working

Could anyone help on why this prints coin store as having 0 members even though my “SecondCoinsStore” successfully saves and loads a leaderstat onto the leaderstats board

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

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

	print(#topTen)
	for rank, data in ipairs(topTen) do
		local name = data.key
		local points = data.value
		print(name .. " is ranked #" .. rank .. " with " .. points .. "points")
	end

end

printTopTenPlayers()

Hey @lordsugarv2


Put in the your topic #help-and-feedback:scripting-support not #development-discussion

There is probably a problem in the data saving part of your code. If you are using an ordered data store then you have to save the data in that database, here is what your saving data code should look like:

local YourDataBase = game:GetService("DataStoreService"):GetOrderedDataStore("YourDataBase")
YourDataBase:SetAsync(UserId,Data)

I had your same problem when I did a leaderboard and it was because I wasn’t saving the data properly.