Make certain parts invisible [DevProduct]

Hi, I am trying to make it so if you buy a devproduct it makes every part transparent with a script inside of it. I have 180 parts in total and 90 needs to be transparent. I can do the pattern manually but it will take a lot of time.

So I want a devproduct that makes parts without any children to have invisiblity for 10 seconds, after 10 seconds it goes back to normal.

ProductID: 1262314973

Put this into a server script:

--//Services
local Players = game:GetService("Players")
local MarketplaceService = game:GetService("MarketplaceService")

--//Tables
local productFunctions = {}

--//Functions
productFunctions[1262314973] = function(receipt, player)
	for i, descendant in ipairs(workspace:GetDescendants()) do
		if descendant:IsA("BasePart") and #descendant:GetChildren() == 0 then
			descendant.Transparency = 1
		end
	end
	
	task.delay(10, function()
		for i, descendant in ipairs(workspace:GetDescendants()) do
			if descendant:IsA("BasePart") and #descendant:GetChildren() == 0 then
				descendant.Transparency = 0
			end
		end
	end)

	return true
end

MarketplaceService.ProcessReceipt = function(receiptInfo)
	local player = Players:GetPlayerByUserId(receiptInfo.PlayerId)

	if not player then
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end

	local Function = productFunctions[receiptInfo.ProductId]

	local success, result = pcall(Function, receiptInfo, player)

	if not success or not result then
		warn("Error occurred while processing a product purchase")
		print("\nProductId:", receiptInfo.ProductId)
		print("\nPlayer:", player)

		return Enum.ProductPurchaseDecision.NotProcessedYet
	end

	return Enum.ProductPurchaseDecision.PurchaseGranted
end

Okay I will try to do that, thank you

Players.supreme_comrade.PlayerGui.Gamepass.TextButton.Script:22: Expected ‘end’ (to close ‘function’ at line 9), got ; did you forget to close ‘then’ at line 18?

Did you not copy and paste it properly?

Oh, sorry lol that was a mistake on my end

image
How do I make it so if you click that then a prompt appears with all that information inside once you buy it?

Use a remote event to the client to make the UI appear or just change the UI on the serverside (easy, but not recommended).

Okay I will do that, thank you