Can't seem to get this Leaderboard to work

I’ve been trying to get a Global Leaderboard for in-game kills for others to see
Screen Shot 2021-12-25 at 6.16.55 PM

the script that is supposed to bring up the players looks like this

local WinsLeaderboard = DataStoreService:GetOrderedDataStore("WinsLeaderboard")

local function updateLeaderboard()
	local success, errorMessage = pcall(function()
		local Data = WinsLeaderboard: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
			for i, v in pairs(game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder:GetChildren()) do
				if v.Player.Text == Name then
					isOnLeaderboard = true

			if Wins > 0 and isOnLeaderboard == false then
				local newLbFrame = game.ReplicatedStorage:WaitForChild("LeaderboardFrame"):Clone()
				newLbFrame.Player.Text = Name
				NewLbFrame.Wins.Text = Wins
				newLbFrame.Rank.Text = "#"..Rank
				newLbFrame.Position =, 0, newLbFrame.Position.Y.Scale + (.08 * #game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder:GetChildren()), 0)
				newLbFrame.Parent = game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder

	if not success then

while true do

	for _, Player in pairs(game.Players:GetPlayers()) do
		WinsLeaderboard:SetAsync(player.UserId, player.leaderstats.Kills.Value)

	for _, frame in pairs(game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder:GetChildren()) do



what exactly isnt working about it

i mean the output isn’t showing any errors but, nothing is appearing on the leaderboard

can you install warn(“success”) after every few lines of code and show the output then?

actually I just got an error that says ServerScriptService.Leaderboards.LeaderboardHandler:41: attempt to index nil with ‘UserId’

yea you actually got that error maybe because you did 2 players in studio

no I’m doing this in a single player studio

any errors?

just the one I showed above with UserId

oh i see now, you made it Player and not player

for _, Player in pairs(game.Players:GetPlayers()) do
		WinsLeaderboard:SetAsync(player.UserId, player.leaderstats.Kills.Value)

at this line

did that fix your error?

the error is now gone, yet nothing is appearing still

maybe your wins is at 0 thats why

i have it set to 40 so, that shouldn’t be the problem

did you wait 60 seconds ?

just set the wait to 10 seconds to be sure and a bunch of warns came my way
Screen Shot 2021-12-25 at 7.52.53 PM

yea maybe thats because the frame isn’t where it was located in the script

no it is in ReplicatedStorage, I don’t see anything thats out of place

Im now only getting nil warnings
Screen Shot 2021-12-25 at 8.09.58 PM