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

1'st one works but 2'nd and 3'rd wont give credits, why? (Developer Product)

Asked by 10 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.
local MarketplaceService = Game:GetService("MarketplaceService")
local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")

HundredID = 19713100
ThousandID = 19775894
TenID = 19775920

MarketplaceService.ProcessReceipt = function(receiptInfo)
    local playerProductKeyHundred = "player_" .. receiptInfo.PlayerId .. "_product_" .. receiptInfo.ProductId
    local numberBought = ds:IncrementAsync(playerProductKeyHundred, 1)

    for i,v in pairs (game.Players:GetChildren()) do
        if v.userId == receiptInfo.PlayerId then
            if receiptInfo.ProductId == HundredID then
                lds = v:FindFirstChild("leaderstats")
                if lds ~= nil then
                    cs = lds:FindFirstChild("Credits")
                    if cs ~= nil then
                        cs.Value = cs.Value + 100


elseif receiptInfo.ProductId == ThousandID then
                        if lds ~= nil then
                            if cs ~= nil then
                                cs.Value = cs.Value + 1000


elseif receiptInfo.ProductId == TenID then
                        if lds ~= nil then
                            if cs ~= nil then
                                cs.Value = cs.Value + 10000
                            end
                        end
                    end
                end
                        end

end
return Enum.ProductPurchaseDecision.PurchaseGranted 
            end
        end
    end
end

~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~

0
Hm? Skenderbeu98 0 — 10y

Answer this question