:GetCurrentPage() is only returning 1 key and value?

Hello. I am making a donation leaderboard, but this script is giving me 1 key/value, even though multiple users have data under this datastore. Can anyone help? Here is my script:

    local TotalWheatODS = game:GetService("DataStoreService"):GetOrderedDataStore("DDS")

local function Handler()
	local succ, Err = pcall(function()
		local Data = TotalWheatODS:GetSortedAsync(false, 50)
        
		local TotalWheatPage = Data:GetCurrentPage()
		 
		for Rank, Data in ipairs(TotalWheatPage) do
			
			local userId = Data.key
			local Name = game.Players:GetNameFromUserIdAsync(tonumber(Data.key))
		       
			local TotalWheat = Data.value
		
			local newObj = game.ReplicatedStorage.Sample:Clone()
			newObj.User.Text = Name
			newObj.Amount.Text = TotalWheat
			newObj.ImageLabel.Image = game.Players:GetUserThumbnailAsync(tonumber(userId), Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size180x180)
			newObj.Parent = workspace.DonationBoard.MainBoard.Main.SurfaceGui.ScrollingFrame
		end
		for i = 1, #workspace.DonationBoard.MainBoard.Main.SurfaceGui.ScrollingFrame:GetChildren() do
			local amount = i - 1
			workspace.DonationBoard.MainBoard.Main.SurfaceGui.ScrollingFrame.CanvasSize = UDim2.new(0,0,0,70*amount)
		end
	end)
	
	if not succ then
	
	end
end

while true do 
	for _, Player in pairs(game.Players:GetPlayers()) do
		TotalWheatODS:SetAsync(Player.UserId, Player:WaitForChild("Donated").Value)
	end
	for _, v in pairs(workspace.DonationBoard.MainBoard.Main.SurfaceGui.ScrollingFrame:GetChildren()) do
		if v:IsA("Frame") then
			v:Destroy()
		end
		
	end
	Handler()
		wait(10)
end
1 Like

Okay, are you the only person showing up on the leaderboard?

If that’s the case, then you might be thinking you can use the data from your current datastore that you save data with, and project it onto that leaderboard. Ordered data stores and normal/global datastores are pretty different. By trying to use the name of your normal datastore, and stick it into GetOrderedDataStore() it will not work. Since you’ve ran this code and tested it, you know have an ordered data store with the name of “DSS”, and it’s only saved your values because you are testing it in studio and no one else has played with it created. When people do play, then they will have a key inserted into the datastore, and then the leaderboard will show those player’s values.

I hope that made sense, but if that was not the case, then I’m not too sure why it’s only showing 1 lol.

Ah, I see. And yes, I was the only person on the leaderboard.