Npc leaderstat loading

I’m making it so it displays the top 10 players on the leaderboard and shows the top 3 as NPCs. The first half is working but the NPCs aren’t, here is the script. There are no errors aswell.

local players = game:GetService("Players")
local dataStoreService = game:GetService("DataStoreService")

local globalDataStore = dataStoreService:GetOrderedDataStore("CoinsGloball")
local board = game.Workspace.GlobalBoard

local template = board.Main.SurfaceGui.Leaderboard.Template:Clone()
board.Main.SurfaceGui.Leaderboard.Template:Destroy()

local function update()
	
	for _,child in pairs(board.Main.SurfaceGui.Leaderboard:GetChildren()) do
		
		if child:IsA("Frame") then
			
			child:Destroy()
			
			
		end
		
	end
	
	local success,err = pcall (function()
		
		local data = globalDataStore:GetSortedAsync(false,10)
		local page = data:GetCurrentPage()
		
		for rank,plrData in ipairs(page) do
			
			local userid = plrData.key
			local coins = plrData.value
			
			if rank < 3 then
				local npc = workspace:FindFirstAncestor(rank)
				
				if npc then 
					
					npc.UserId.Value = userid
				end
			end
			
			
			local new = template:Clone()
			new.PlrName.Text = players:GetNameFromUserIdAsync(userid)
			new.PlrAmount.Text = coins
			new.LayoutOrder = rank
			
			new.Parent = board.Main.SurfaceGui.Leaderboard
		
		
		end
	end)
	
end

while true do
	
	update()
	
	wait(math.random(2,5))
	
	spawn (function()
		
		for _,plr in pairs(game.Players:GetPlayers()) do
			
			globalDataStore:SetAsync(plr.UserId,plr.leaderstats.Coins.Value)
			wait()
			
			
		end
	end)
	
end

Heres the data thingy just in case if needed

local players = game:GetService("Players")
local dataStoreService = game:GetService("DataStoreService")

local saveDataStore = dataStoreService:GetDataStore("Statss")

players.PlayerAdded:connect(function(plr)
	
	local stat = Instance.new("Folder")
	stat.Name = "leaderstats"
	stat.Parent = plr
	
	local coins = Instance.new("IntValue")
	coins.Name = "Coins"
	coins.Parent = stat
	
	
	local data = saveDataStore:GetAsync(plr.UserId)
	
	if data then
		
		for name,value in pairs(data.stat) do
			
			stat[name].Value = value
		end
	end
end)

players.PlayerRemoving:connect(function(plr)
	
	local saveData = {stat = {}}
	
	for _,stat in pairs(plr.leaderstats:GetChildren()) do
		
		saveData.stat[stat.Name] = stat.Value
	end
	
	saveDataStore:SetAsync(plr.UserId,saveData)
	
end)

game:BindToClose(function()
	
	for _,plr in pairs(players:GetPlayers()) do
		
		local saveData = {stat = {}}
		
		for _,stat in pairs(plr.leaderstats:GetChildren()) do
			
			saveData.stat[stat.Name] = stat.Value
		end
		
		saveDataStore:SetAsync(plr.UserId,saveData)
		
	end
	
	wait(2)
	
end)