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

local plr = script.Parent.Parent.Parent.Parent.Parent
local link = game:GetService("MarketplaceService")
deb = 0
script.Parent.MouseButton1Click:connect(function()
    local marketId = 43143148  --ID OF YOUR DEVELOPER PRODUCT  
    link:PromptProductPurchase(plr,marketId)
    link.ProcessReceipt = function(receiptInfo)
        if Enum.ProductPurchaseDecision.PurchaseGranted and receiptInfo.PlayerId == plr.userId then
            if deb == 0 then
                deb = 1
                plr.leaderstats.Snowflakes.Value = plr.leaderstats.Snowflakes.Value + 5000 --Alter what stat you would like to increase or decrease after the player has purchased.
                wait(1)
                deb = 0
            end
            return Enum.ProductPurchaseDecision.PurchaseGranted
        end
    end
end)
0
You really should have two separate scripts for this. https://scriptinghelpers.org/questions/27112/how-do-i-use-dev-products#30658 M39a9am3R 3210 — 7y
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 — 7y

Answer this question