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

My Product handler wont work it didn't even print the Completed help?

Asked by 2 years ago
local mps = game:GetService("MarketplaceService")


mps.ProcessReceipt = function(receiptInfo)
    if receiptInfo.ProductId == 1327541228 then -- Replace the id
        local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
        local Player = game.Players.FindFirstChild(player.Name)
        local Stats = Player:WaitForChild("leaderstats")
        local Donated = Stats.Donated

        Donated.Value = Donated.Value + 1000
        print("Completed")

        return Enum.ProductPurchaseDecision.PurchaseGranted

    elseif receiptInfo.ProductId == 1327541229 then -- Replace the id
        local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
        local Player = game.Players.FindFirstChild(player.Name)
        local Stats = Player:WaitForChild("leaderstats")
        local Donated = Stats.Donated

        Donated.Value = Donated.Value + 5000
        print("Completed")

        return Enum.ProductPurchaseDecision.PurchaseGranted
end
end

Answer this question