Leaderboard Script isn't working!

Hello, I am having issues with my leaderboard script, and I am asking for anyone to help.

local DataStoreService = game:GetService("DataStoreService")
local OrderedDataStore = DataStoreService:GetOrderedDataStore('Bucks_ordered')

local function update()
	local success,errMessage = pcall(function()
		local Data = OrderedDataStore:GetSortedAsync(false,50)
		local CurrentPage = Data:GetCurrentPage()
		for Rank, data in ipairs(CurrentPage) do
			local userName = game.Players:GetNameFromUserIdAsync(data.key)
			local name = userName
			local cash = data.Value
			local isOnLeaderboard = false
			for i,v in pairs(script.Parent.Scroll.SurfaceGui.Scroll:GetChildren()) do
				if v:IsA("Frame") then
					if v.Player.Text == name then
						isOnLeaderboard = true
						break
					end
				end
			end
			
			if cash and isOnLeaderboard == false then
				local newLeaderboard = game.ServerStorage:WaitForChild("Stat"):Clone()
				newLeaderboard.Player.Text = name
				newLeaderboard.Cash.Text = "$" .. cash
				newLeaderboard.Parent = script.Parent.Scroll.SurfaceGui.Scroll
			end
		end
	end)
end

while true do
	for _, frame in pairs(script.Parent.Scroll.SurfaceGui.Scroll:GetChildren()) do
		if frame:IsA("Frame") then
			frame:Destroy()
		end
	end
	update()
	print("update")
	wait(30)
end

I followed a YT tutorial to create the script, here is how it looks in game:
image

3 Likes

whats the issue here jabroski you gotta provide sum more info

1 Like

I mean it’s pretty obvious, nobody is showing up on the leaderboard.

Could you provide the link to the tutorial you followed

It’s TheDevKings’ tutorial. How to Make A Global Leaderboard in Roblox Studio - YouTube