SHOW:
|
|
- or go back to the newest paste.
1 | local MarketplaceService = game:GetService("MarketplaceService") | |
2 | local Players = game:GetService("Players") | |
3 | ||
4 | ||
5 | local productFunctions = {} | |
6 | ||
7 | ||
8 | productFunctions[1538160020] = function(receipt, player) | |
9 | player.leaderstats.Diamonds.Value += 100000 | |
10 | end | |
11 | ||
12 | ||
13 | local function processReceipt(receiptInfo) | |
14 | local userId = receiptInfo.PlayerId | |
15 | local productId = receiptInfo.ProductId | |
16 | ||
17 | ||
18 | local player = Players:GetPlayerByUserId(userId) | |
19 | ||
20 | ||
21 | if player then | |
22 | local handler = productFunctions[productId] | |
23 | local success, result = pcall(handler, receiptInfo, player) | |
24 | if success then | |
25 | return Enum.ProductPurchaseDecision.PurchaseGranted | |
26 | else | |
27 | warn("Failed to process receipt:", receiptInfo, result) | |
28 | end | |
29 | end | |
30 | ||
31 | ||
32 | return Enum.ProductPurchaseDecision.NotProcessedYet | |
33 | end | |
34 | ||
35 | ||
36 | MarketplaceService.ProcessReceipt = processReceipt |