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

Error At Handling Transactions [DataStore]?

Asked by 8 years ago
local MarketplaceService = game:GetService("MarketplaceService")
local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
local productId = 29974967

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.Gems.Value = player.Gems.Value + 5
            end
        end
    end 

    local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_purchase_" .. receiptInfo.ProductId
    ds:IncrementAsync(playerProductKey, 1)  

    return Enum.ProductPurchaseDecision.PurchaseGranted     
end

I do not use a leaderstats model (I put the variables in the player directly) and no errors in output, it keeps giving me an error when I try to purchase the dev. Product.

Answer this question