Why are my guis not showing up?

so i have been working on a code for most sponsored:


wait(5)

-- DevProductTracking Script
local Players = game:GetService("Players")
local MarketplaceService = game:GetService("MarketplaceService")
local DataStoreService = game:GetService("DataStoreService")
local devProductSpentStore = DataStoreService:GetDataStore("DevProductSpent")

-- Create a template for the leaderboard entries
local leaderboardTemplate = Instance.new("Frame")
leaderboardTemplate.Size = UDim2.new(0, 100, 0, 20)
leaderboardTemplate.BackgroundColor3 = Color3.new(0.2, 0.2, 0.2)
leaderboardTemplate.BorderColor3 = Color3.new(0.5, 0.5, 0.5)

-- Create a TextLabel for the rank
local rankLabel = Instance.new("TextLabel")
rankLabel.Parent = leaderboardTemplate
rankLabel.Text = "Rank"
rankLabel.Font = Enum.Font.SourceSans
rankLabel.FontSize = Enum.FontSize.Size14
rankLabel.TextColor3 = Color3.new(1, 1, 1)

-- Create a TextLabel for the username
local usernameLabel = Instance.new("TextLabel")
usernameLabel.Parent = leaderboardTemplate
usernameLabel.Text = "Username"
usernameLabel.Font = Enum.Font.SourceSans
usernameLabel.FontSize = Enum.FontSize.Size14
usernameLabel.TextColor3 = Color3.new(1, 1, 1)

-- Create a TextLabel for the amount spent
local amountLabel = Instance.new("TextLabel")
amountLabel.Parent = leaderboardTemplate
amountLabel.Text = "Amount Spent"
amountLabel.Font = Enum.Font.SourceSans
amountLabel.FontSize = Enum.FontSize.Size14
amountLabel.TextColor3 = Color3.new(1, 1, 1)

-- Set the leaderboard template as a child of the SurfaceGui
local surfaceGui = game.Workspace.Topsponsorboard.Part1.SurfaceGui
local leaderboardTemplate = surfaceGui.Frame.objTemplate 


-- Table to keep track of the Robux spent by each player
local playerSpent = {}

-- Function to update the leaderboard
local function updateLeaderboard()
	-- Update the leaderboard
	local sortedPlayers = {}
	for userId, amount in pairs(playerSpent) do
		table.insert(sortedPlayers, {userId = userId, amount = amount})
	end
	table.sort(sortedPlayers, function(a, b) return a.amount > b.amount end)

	-- Limit to top 10 spenders
	local topSpenders = {}
	for i = 1, math.min(10, #sortedPlayers) do
		topSpenders[i] = sortedPlayers[i]
	end

	-- Update the SurfaceGui
	local surfaceGui = game.Workspace.Topsponsorboard.Part1.SurfaceGui
	surfaceGui:ClearAllChildren()

	for rank, data in ipairs(topSpenders) do
		local clone = leaderboardTemplate:Clone()
		clone.Parent = surfaceGui
		clone.Rank.Text = tostring(rank)
		clone.Username.Text = Players:GetNameFromUserIdAsync(data.userId)
		clone.Amount.Text = tostring(data.amount) .. " Robux"
		clone.ProfilePicture.Image = "https://www.roblox.com/headshot-thumbnail/image?userId=" .. data.userId .. "&width=420&height=420&format=png"
		clone.Visible = true
	end

    -- Sort the table based on the amount spent
    table.sort(sortedPlayers, function(a, b) return a.amount > b.amount end)
    
    -- Limit to top 10 spenders
    local topSpenders = {}
    for i = 1, math.min(10, #sortedPlayers) do
        topSpenders[i] = sortedPlayers[i]
    end
    
    -- Update the SurfaceGui
    local surfaceGui = game.Workspace.Topsponsorboard.Part1.SurfaceGui
    local template = surfaceGui.Frame.objTemplate:Clone()
    surfaceGui:ClearAllChildren()
    
    for rank, data in ipairs(topSpenders) do
        local clone = template:Clone()
        clone.Parent = surfaceGui
        clone.Values.Number.Text = tostring(rank)
        clone.Values.Username.Text = Players:GetNameFromUserIdAsync(data.userId)
        clone.Values.Value.Text = tostring(data.amount) .. " Robux"
        clone.ProfilePicture.Image = "https://www.roblox.com/headshot-thumbnail/image?userId=" .. data.userId .. "&width=420&height=420&format=png"
        clone.Visible = true
    end
end

-- Function to handle the purchase of a developer product
local function onProductPurchase(player, productId, amountSpent)
    local userId = player.UserId
    if playerSpent[userId] then
        playerSpent[userId] = playerSpent[userId] + amountSpent
    else
        playerSpent[userId] = amountSpent
    end
    
    -- Save the updated amount to the DataStore
    local success, errorMessage = pcall(function()
        devProductSpentStore:SetAsync(tostring(userId), playerSpent[userId])
    end)
    
    if not success then
        warn("Failed to save data for user: " .. userId .. ". Error: " .. errorMessage)
    end
    
    updateLeaderboard()
end

-- Connect the ProductPurchase event
MarketplaceService.ProcessReceipt = function(receiptInfo)
    local player = Players:GetPlayerByUserId(receiptInfo.PlayerId)
    if player then
        -- Assuming the amount spent is directly the price of the product. Adjust as necessary.
        onProductPurchase(player, receiptInfo.ProductId, receiptInfo.CurrencySpent)
        return Enum.ProductPurchaseDecision.PurchaseGranted
    else
        return Enum.ProductPurchaseDecision.NotProcessedYet
    end
end

-- Load existing data
local function loadData()
    for _, player in ipairs(Players:GetPlayers()) do
        local success, amountSpent = pcall(function()
            return devProductSpentStore:GetAsync(tostring(player.UserId)) or 0
        end)
        
        if success then
            playerSpent[player.UserId] = amountSpent
        else
            warn("Failed to load data for user: " .. player.UserId)
        end
    end
    updateLeaderboard()
end

-- Initial load
loadData()

-- Listen for new players joining to load their data
Players.PlayerAdded:Connect(function(player)
    local success, amountSpent = pcall(function()
        return devProductSpentStore:GetAsync(tostring(player.UserId)) or 0
    end)
    
    if success then
        playerSpent[player.UserId] = amountSpent
        updateLeaderboard()
    else
        warn("Failed to load data for user: " .. player.UserId)
    end
end)

so basically i go to playtest, and this is all that shows up!
Screenshot 2024-05-28 091140
for comparison this is what it looks like when not playtesting:
Screenshot 2024-05-28 091212

Check on the properties and see if Archivable is turned off, if it is then turn it back on.

you call surfaceGui:ClearAllChildren() twice within your updateLeaderboard() function.