:GetCurrentPage() only returns two keys and values, even though there are multiple people on a datastore?

So, I have a leaderboard here, but :GetCurrentPage() only returns two keys and values, but #:GetCurrentPage() returns 4. So there are multiple people on the datastore, but only two values. Can anyone help? Here is my script:

local function Handler()
	local Success, Err = pcall(function()
		local Page = game:GetService('DataStoreService'):GetOrderedDataStore('Donate'):GetSortedAsync(false, 50):GetCurrentPage()

		for Rank, Data in ipairs(Page) do
print(#Page) --prints 4
			if tonumber(Data.key) >1 then
				
				print(Data.value)--only prints two times
				local Name = game.Players:GetNameFromUserIdAsync(Data.key)
				local UserId = Data.key
				local Cash = Data.value
				if tonumber(Data.value) >=5 then
					local NewObj = game.ReplicatedStorage.Sample:Clone()
					NewObj.User.Text = Name
					NewObj.Amount.Text = game:GetService('DataStoreService'):GetDataStore('Donate'):GetAsync(UserId)
					NewObj.Img.Image = game.Players:GetUserThumbnailAsync(UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size100x100)
					NewObj.Parent = game.Workspace.DonationBoard.MainBoard.Main.SurfaceGui.ScrollingFrame
					if Rank == 1 then
						NewObj.BackgroundColor3 = Color3.fromRGB(223, 232, 56)
						local topUser = game.Players:GetUserIdFromNameAsync(NewObj.User.Text)
						workspace.TopDonator.Configuration.userId.Value = topUser
						workspace.TopDonator.Head.Rank.RankText.Text = game:GetService('DataStoreService'):GetDataStore('RoleStore'):GetAsync(topUser)
						workspace.TopDonator.Head.NameText.InformationLabel.Text = NewObj.User.Text
					end
					if Rank == 2 then
						NewObj.BackgroundColor3 = Color3.fromRGB(142, 143, 130)
					end
					if Rank == 3 then
						NewObj.BackgroundColor3 = Color3.fromRGB(189, 120, 62)
					end
				end
				for i = 1, #game.Workspace.DonationBoard.MainBoard.Main.SurfaceGui.ScrollingFrame:GetChildren() do
					local amount = i - 1
					game.Workspace.DonationBoard.MainBoard.Main.SurfaceGui.ScrollingFrame.CanvasSize = UDim2.new(0,0,0,amount*100)
				end
			end
		end
	end)
	if not Success then
		error("Error: " .. Err)
	end
end
while true do
	for _, Frame in pairs(workspace.DonationBoard.MainBoard.Main.SurfaceGui.ScrollingFrame:GetChildren()) do
		if Frame:IsA('Frame') then
			Frame:Destroy()
		end
	end
	Handler()
	wait(10)
end

it prints 4 because there are only 4 people on the datastore if you dont get what i mean it is only 4 people inside the datastore system with keys and values

its because only 4 people played your game or something

Yeah, but the thing is, the ipairs() loop runs two times instead of 4. It should create 4 frames, but it only creates 2

you are comparing the numbers to see if they donated more then 5 robux and probably the other 2 donated less then 5 robux or equal to 5

for now you can debug it by printing Data.Value before any if statements

I see. It prints two user ID’s and two values as it should, but then it prints ’ 0-1’, and ‘0-2’, and 0 being the data.value, and -1 and -2 being the data.key, data.key should be a user id tho

well because its divided by 2

2 keys and 2 values which makes it 4 your leaderboard is fine

Yeah, but 4 people have donated, and when I use :GetAsync() for the person that donated, I get the actual amount they donateed

then what would happen? see if they donated more then 5 robux?

There are only 2 people on the board, well technically just me bc someone on the datastore is 0, but when i use :getdatastore() to check, it gets how much they donated. but on the ordered datastore, there are only 2/4 people. and the two people that are missing have donated more than 5 robux

Eh, maybe because i was using :setasync() on :getdatastore(), not :getordereddatastore(). I made a new data store and used :setasync() on :getordereddatastore().