I'm trying to make a global leaderboard but every time it updates it won't update

--global leaderboard script

local ds = game:GetService("DataStoreService")

local winODS = ds:GetOrderedDataStore("winSaveSystem")


local timeUntilReset = 2


while wait(1) do
	timeUntilReset = timeUntilReset - 1
	script.Parent.Parent.ResetTime.Text = "Resetting in " .. timeUntilReset .. " seconds..."
	if timeUntilReset == 0 then
		timeUntilReset = 1
		for i, plr in pairs(game.Players:GetPlayers()) do
			
			winODS:SetAsync(plr.UserId, plr.leaderstats.Wins.Value)
		end
		
		for i, leaderboardRank in pairs(script.Parent:GetChildren()) do
			
			if leaderboardRank.ClassName == "Frame" then
				leaderboardRank:Destroy()
			end
		end
		local success, errorMsg = pcall(function()
			
			local data = winODS:GetSortedAsync(false, 50)
			local winPage = data:GetCurrentPage()
			
			for rankInLB, dataStored in ipairs(winPage) do
				local name = game.Players:GetNameFromUserIdAsync(tonumber(dataStored.key))
				local win = dataStored.value
				local template = script.Template:Clone()	
				template.Name = name .. "Leaderboard"
				template.PlrName.Text = name
				template.Rank.Text = "#" .. rankInLB
				template.win.Text = win
				template.Parent = script.Parent				
			end			
		end)
	end
end

I also made a leaderstats script which is the ingame leaderboard

local datastore = game:GetService("DataStoreService")
local ds1 = datastore:GetDataStore("winSaveSystem")
local ds2 = datastore:GetDataStore("CashSaveSystem")

game.Players.PlayerAdded:connect(function(plr)
 local leaderstats = Instance.new("Folder", plr)
 leaderstats.Name = "leaderstats"
 local wins = Instance.new("IntValue", leaderstats)
 wins.Name = "Wins"
 local Cash = Instance.new("IntValue", leaderstats)
 Cash.Name = "Cash"

 
 wins.Value = ds1:GetAsync(plr.UserId) or 0
 ds1:SetAsync(plr.UserId, wins.Value)
 
 Cash.Value = ds2:GetAsync(plr.UserId) or 0
 ds2:SetAsync(plr.UserId, Cash.Value)
 
 wins.Changed:connect(function()
  ds1:SetAsync(plr.UserId, wins.Value)
 end)
 
 Cash.Changed:connect(function()
  ds2:SetAsync(plr.UserId, Cash.Value)
 end)
end)