Can't figure out how to fix the update GlobalLeaderboard GUI

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

  1. What do you want to achieve? I want to update the leaderboard gui every 60 seconds.

  2. What is the issue? My update-script for global leaderboard seems not working because it only shows the first loaded data.

  3. What solutions have you tried so far? I tried reading line-by-line the code but I didn’t understand it.

-- The Global Leaderboard Script

local function updateLeaderboard()
	local success, errorMessage = pcall(function()
		local Data = WinsLeaderboard:GetSortedAsync(false, 10)
		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 leaderBoardHolder = game.Workspace:WaitForChild("LeaderBoard"):WaitForChild("Main Panel"):WaitForChild("LeaderBoardGUI"):WaitForChild("Holder")
			local isOnLeaderboard = false
			local isRankOnLeaderboard = false
			
			for i, v in pairs(leaderBoardHolder:GetChildren()) do
				if v:IsA("Frame") then
					if v:WaitForChild("2_PlayerName").Text == Name then
						isOnLeaderboard = true
						break
					end
				end
			end
			
			if Wins > 0 and isOnLeaderboard == false then
				local newLeaderboardFrame = game.ReplicatedStorage:WaitForChild("LeaderboardFrame"):Clone()
				
				
				for i, v in pairs(leaderBoardHolder:GetChildren()) do
					if v:IsA("Frame") then
						if v:WaitForChild("1_Rank").Text == Rank then
							isRankOnLeaderboard = true
							break
						end
					end
				end
				
				if isRankOnLeaderboard then	
					newLeaderboardFrame:WaitForChild("1_Rank").Text = "#"..Rank + 1
				else
					newLeaderboardFrame:WaitForChild("1_Rank").Text = "#"..Rank
				end
				
				newLeaderboardFrame:WaitForChild("2_PlayerName").Text = Name
				newLeaderboardFrame:WaitForChild("3_Wins").Text = Wins		
				
				if Rank == 1 then
					newLeaderboardFrame:WaitForChild("1_Rank").BackgroundColor3 = Color3.fromRGB(255, 21, 0)
					newLeaderboardFrame:WaitForChild("2_PlayerName").BackgroundColor3 = Color3.fromRGB(255, 21, 0)
					newLeaderboardFrame:WaitForChild("3_Wins").BackgroundColor3 = Color3.fromRGB(255, 21, 0)
				elseif Rank == 2 then
					newLeaderboardFrame:WaitForChild("1_Rank").BackgroundColor3 = Color3.fromRGB(255, 170, 0)
					newLeaderboardFrame:WaitForChild("2_PlayerName").BackgroundColor3 = Color3.fromRGB(255, 170, 0)
					newLeaderboardFrame:WaitForChild("3_Wins").BackgroundColor3 = Color3.fromRGB(255, 170, 0)
				elseif Rank == 3 then
					newLeaderboardFrame:WaitForChild("1_Rank").BackgroundColor3 = Color3.fromRGB(255, 255, 127)
					newLeaderboardFrame:WaitForChild("2_PlayerName").BackgroundColor3 = Color3.fromRGB(255, 255, 127)
					newLeaderboardFrame:WaitForChild("3_Wins").BackgroundColor3 = Color3.fromRGB(255, 255, 127)
				else
					newLeaderboardFrame:WaitForChild("1_Rank").BackgroundColor3 = Color3.fromRGB(255, 255, 255)
					newLeaderboardFrame:WaitForChild("2_PlayerName").BackgroundColor3 = Color3.fromRGB(255, 255, 255)
					newLeaderboardFrame:WaitForChild("3_Wins").BackgroundColor3 = Color3.fromRGB(255, 255, 255)
				end
				
				newLeaderboardFrame.Parent = leaderBoardHolder
				
			end
		end
	end)
	--[[
	]]
	if not success then
		warn(errorMessage)
	end
end

--This is the loop that will update the GlobalLeaderboard GUI (It doesn't work at all even though I edited my leaderstats value and updated it on the datastore)
while true do
	local leaderBoardHolder = game.Workspace:WaitForChild("LeaderBoard"):WaitForChild("Main Panel"):WaitForChild("LeaderBoardGUI"):WaitForChild("Holder")
	for _, player in pairs(game.Players:GetPlayers()) do
		WinsLeaderboard:SetAsync(player.UserId, player.playerStats.Wins.Value)
	end
	
	for _, frame in pairs(WinsLeaderboard:getChildren()) do
		if frame:IsA("Frame") then
			frame:Destroy()
		end
	end
	
	updateLeaderboard()
	print("Leaderboard Updated!")
	
	wait(60)
end