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.
--//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
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?