Okay, so I am making a game, and it has a GUI Ordered Leaderboard that uses ODS (Ordered DataStores). I previously had the leaderboard working on a SurfaceGui, but I wanted to turn it into a ScreenGui... So I did. And when I did, it basically stopped updating. Please tell me what I have done wrong, how I could possibly fix it, and if there's a possible way to improve it.

Wiki links & in-depth examples would be greatly appreciated for future reference with Data & DataStores.

This code is written in a regular Script...

local Data = game:GetService("DataStoreService"):GetOrderedDataStore("ScoreBoard")


game.Players.PlayerAdded:connect(function(Player)
	
	wait(3)
		
	while true do
		wait(5)	
		
		Data:SetAsync(Player.Name, Player.Apples.Value)
		
	end
end)

function updateBoard(board, data)
	for k,v in pairs(data) do
		local pos = k
		local name = v.key
		local score = v.value
		local nametextbox = board.Apples:FindFirstChild("Name" .. pos)
		nametextbox.Text = name
		local scoretextbox = board.Apples:FindFirstChild("Name" .. pos).Score
		scoretextbox.Text = score
	end	
end

while true do
	local pages = Data:GetSortedAsync(false, 10)
	local data = pages:GetCurrentPage()
	updateBoard(script.Parent, data)
	if not pages.IsFinished then
		pages:AdvanceToNextPageAsync()
		data = pages:GetCurrentPage()
		updateBoard(script.Parent.Next10, data)
	end
	wait(.1)
end

Please answer as soon as possible. I have plenty of players asking me to fix the leaderboard.

NOTE: I have reposted this several times, without anybody helping. I need to fix my game ASAP.