GetCurrentPage is not a valid member of datatstorePages 'Instance'

You can write your topic however you want, but you need to answer these questions:

  1. I want to make a Global leaderboard

image

3.tried to fix myself but didnt work searched still nothing

if you could help that would be awesome Thank you!

local function UpdateLeaderboard()
	local succes, err = pcall(function()
		local data = dataStore:GetSortedAsync(false, 5)
		local WinsPage = data:getcurrentPage()
		for rank, data in ipairs(WinsPage) do
			local userName = game.Players:GetNameFromUserIdAsync(tonumber(data.key))
			local Name = userName
			local Wins = data.value
			local isOnLeaderboard = false
			local image = game.Players:GetUserThumbnailAsync(PlayerService:GetUserIdFromNameAsync(Name), Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size150x150)
			for i, v in pairs(workspace["Global Leaderboard"].SurfaceGui.ScrollingFrame:GetChildren()) do
				if v.Player.Text == Name then
					isOnLeaderboard = true
					break
				end
			end
			local color = Color3.new(1,1,1)--Default color
			if rank == 1 then
				color = Color3.new(1,1,0)--1st place colorf
			elseif rank == 2 then
				color = Color3.new(0.9,0.9,0.9)--2nd place color
			elseif rank == 3 then
				color = Color3.fromRGB(166, 112, 0)--3rd place color
			end

			if Wins and isOnLeaderboard == false then
				local newLBFrame = script.Sample:Clone()
				newLBFrame.Player.Text = Name
				newLBFrame.Wins.Text = Wins
				newLBFrame.Image = image
				newLBFrame.Image.Place.Text = rank
				newLBFrame.LayoutOrder = rank
				newLBFrame.Player.TextColor3 = color
				newLBFrame.Image.Place.TextColor3 = color
				newLBFrame.Wins.TextColor3 = color
				newLBFrame.Name = Name
				newLBFrame.Parent = script.Parent.ScrollingFrame
			end
		end
	end)

	if not succes then
		print(err)
	end
end
1 Like

“local WinsPage = data:getcurrentPage()”

Missing caps, it’s GetCurrentPage

2 Likes