Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Did I put the PurchaseGranted - line in the correct place in this script?

Asked by 8 years ago

Did I put the PurchaseGranted - line in the correct place in this script?

I am generally new to developer products, that is why I wnat to know if I put the PurchaseGranted - line in the correct place.

01local plr = script.Parent.Parent.Parent.Parent.Parent
02local link = game:GetService("MarketplaceService")
03deb = 0
04script.Parent.MouseButton1Click:connect(function()
05    local marketId = 43143148  --ID OF YOUR DEVELOPER PRODUCT 
06    link:PromptProductPurchase(plr,marketId)
07    link.ProcessReceipt = function(receiptInfo)
08        if Enum.ProductPurchaseDecision.PurchaseGranted and receiptInfo.PlayerId == plr.userId then
09            if deb == 0 then
10                deb = 1
11                plr.leaderstats.Snowflakes.Value = plr.leaderstats.Snowflakes.Value + 5000 --Alter what stat you would like to increase or decrease after the player has purchased.
12                wait(1)
13                deb = 0
14            end
15            return Enum.ProductPurchaseDecision.PurchaseGranted
16        end
17    end
18end)
0
You really should have two separate scripts for this. https://scriptinghelpers.org/questions/27112/how-do-i-use-dev-products#30658 M39a9am3R 3210 — 8y
0
Also, with this script reproducing itself to every player's PlayerGui, the ProcessReceipt may only be picked up by one callback function. So one player's script may pick up on your transaction and can't do anything about it. M39a9am3R 3210 — 8y

Answer this question