local MarketplaceService = game:GetService("MarketplaceService")
local ProductToQuantity = {
[3297578083] = 1000,
[3296774010] = 25000,
[3296774101] = 100000,
[3296774225] = 250000,
}
MarketplaceService.ProcessReceipt = function(receiptInfo)
print("Processing receipt for player: " .. receiptInfo.PlayerId .. " and product: " .. receiptInfo.ProductId)
local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
if not player then
print("error")
return Enum.ProductPurchaseDecision.NotProcessedYet
end
local leaderstats = player:FindFirstChild("leaderstats")
if leaderstats then
print("leaderstats found")
local money = leaderstats:FindFirstChild("Money")
print("Money found")
if money and ProductToQuantity[receiptInfo.ProductId] then
print("Money and product found")
money.Value = money.Value + ProductToQuantity[receiptInfo.ProductId]
end
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
print("done")
the products are prompted when a ui button is pressed which already is working
** You are now Level 2! **