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

Weird glitch with Dev Product?

Asked by
Agios 10
9 years ago

So, the Dev Product is supposed to award 10,000 cash, but it seems to just award random amounts.. I buy the Dev Product and sometimes get 16k, then the next time I got 9k, then 19k. I have the following script located in Workspace:

local MarketplaceService = Game:GetService("MarketplaceService")

local productId = 22716169


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.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 10000
            end
        end
    end 


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


    return Enum.ProductPurchaseDecision.PurchaseGranted     
end

And then this in a TextButton where you purchase the DevProduct:

local purchase = script.Parent
local productId = 22716169


purchase.MouseButton1Click:connect(function()
    game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, productId)
end)

Answer this question