I want to have multiple dev products in one script.
The issue is it only works for one button, not for the other buttons.
I tried looking for some solutions the the DevForum, but there’s nothing with this question.
Server Script:
local marketplaceService = game:GetService("MarketplaceService")
local productIDs = {
{
product = 1274134792,
coins = 100
},
{
product = 1274134895,
coins = 300
},
{
product = 1274134793,
coins = 600
}
}
marketplaceService.ProcessReceipt = function(recieptInfo)
for i, v in pairs(productIDs) do
local playerPurchasing = game.Players:GetPlayerByUserId(recieptInfo.PlayerId)
if not playerPurchasing then
print("Player didn't purchase the product")
return Enum.ProductPurchaseDecision.NotProcessedYet
end
if recieptInfo.ProductId == v.product then
print("Purchased!")
playerPurchasing.Coins.Value += v.coins
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end
Local scripts:
local marketplaceService = game:GetService("MarketplaceService")
local productID = 1274134895 <-- Product ID is different for the scripts
local player = game.Players.LocalPlayer
script.Parent.Activated:Connect(function()
marketplaceService:PromptProductPurchase(player, productID)
end)