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

how do i make process receipt work?

Asked by
Plieax 66
6 years ago

This is what i have on a server script. I have an error on line 3

local marketserv = game:GetService("MarketplaceService")

marketserv.ProccessReceipt:connect(function(purchaseinfo)
    local plr1 = game.Players:GetPlayerByUserId(purchaseinfo.PlayerId)
    local cash = plr1.leaderstats.Cash
        if purchaseinfo.ProductId == 270172519 then
            cash.Value = cash.Value + 100
        end

end)

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

Don't use :connect (or :Connect) for this, also you didn't set a return value!

local marketserv = game:GetService("MarketplaceService")

function marketserv.ProccessReceipt(purchaseinfo)
    local plr1 = game.Players:GetPlayerByUserId(purchaseinfo.PlayerId)
    local cash = plr1.leaderstats.Cash
        if purchaseinfo.ProductId == 270172519 then
            cash.Value = cash.Value + 100
    return Enum.ProductPurchaseDecision.PurchaseGranted --> Any code after this won't run, unless the code doesn't get runned.  
        end
end
0
this still doesn't give the player money Plieax 66 — 6y
0
can you use prints to find where the problem is? User#20388 0 — 6y
0
not even the function fires Plieax 66 — 6y
Ad

Answer this question