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

Why is my developer product not awarding credits on purchase? [IMPORTANT]

Asked by 9 years ago
local MarketplaceService = game:GetService("MarketplaceService")
local ds = game:GetService("DataStoreService"):GetDataStore("countdowncreditservice")
local productID = 23394060

MarketplaceService.ProcessReceipt = function(receiptInfo)
    for i, player in ipairs(game.Players:GetChildren()) do
        if player.userId == receiptInfo.PlayerId then
            if receiptInfo.ProductId == productID then
                player.statistics.credits.Value = player.statistics.credits.Value + 50
                local key = "plyr-"..player.userId
                local savedvalue = {player.statistics.credits.Value}
                ds:SetAsync(key, savedvalue)

                return Enum.ProductPurchaseDecision.PurchaseGranted
            end
        end
    end
    return Enum.ProductPurchaseDecision.PurchaseGranted     
end

The ID is correct, I'm getting no errors. This is supposed to process the receipt. I don't understand what the problem is.

0
This is really important. dirty_catheter 7 — 9y
0
I don't know how expensive this is to test (can you make a free test product?), but if it's cheap/free, I'd put in a bunch of print statements to explain 1. what lines the script is running, and 2. what the values of variables are (to explain why 'if' statements might be returning false when you don't expect them to). Press F9 for developer console to see the output if testing online. chess123mate 5873 — 9y

Answer this question