GetStoredAsync is not a valid member of OrderedDataStore

I am trying to make a leaderboard for my the people with the top 10 wins in my game, so I got some code from a YouTube video and I found this:

local Store = game:GetService("DataStoreService"):GetOrderedDataStore("TopWins")

while true do
	local Ascending = false
	local PageSize = 10
	local pages = Store:GetStoredAsync(Ascending, PageSize)
	local CurrentPage = pages:GetCurrentPage()
	
	for i,v in pairs (script.Parent:GetChildren()) do
		if v.name ~= "Label" and v ~= script then
			v.Visible = false
		end
	end
	
	for i,v in pairs (CurrentPage) do
		local key = v.Key
		local value = v.value
		local text = script.Parent:FindFirstChild("Position" .. i)
		
		text.Visible = true
		text.Username.Text = game.Players:GetNameFromUserIdAsync(key)
		text.Wins.Text = value
	end
	
	wait(60)
end

However, when I run my game, I get this error:

GetStoredAsync is not a valid member of OrderedDataStore

I would appreciate it if someone could please help me out, thanks!

That’s because ‘GetStoredAsync’ isn’t a valid function of OrderedDataStore (as far as I’m aware).
Did you mean GetSortedAsync?

3 Likes

You have a typo. Do GetSortedAsync instead.

1 Like

Thank you, it worked!
(30 characters)

1 Like