Here is my developer product code:
local fiveId = 30947986
local tenId = 30948013
local twentyfiveId = 30948036
local PurchaseHistory = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
game:GetService("MarketplaceService").ProcessReceipt = function(receiptInfo)
for i, player in ipairs(game.Players:GetChildren()) do
if player.userId == receiptInfo.PlayerId then
local cash = player.leaderstats.Cash
if receiptInfo.ProductId == fiveId then
cash.Value = cash.Value + 5000
print(player.Name .. " purchased 5K.")
elseif receiptInfo.ProductId == tenId then
cash.Value = cash.Value + 10000
print(player.Name .. " purchased 10K.")
elseif receiptInfo.ProductId == twentyfiveId then
cash.Value = cash.Value + 25000
print(player.Name .. " purchased 25K.")
end
end
end
local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_purchase_" .. receiptInfo.ProductId
PurchaseHistory:IncrementAsync(playerProductKey, 1)
return Enum.ProductPurchaseDecision.PurchaseGranted
end
Right now when I buy a product it runs through the script multiple times. Buying the 5K might add 5000 to my cash one time but then buy it again and it might add 15000 or 20000.
I bought the 10k one and the output was: Player purchased 10K. Player purchased 10K. Player purchased 10K. Player purchased 10K. Player purchased 10K. Player purchased 25K.

4 comments
Add a debounce, cause it's running it more than once sometimes.
Is there anything in the output?
And how can they add random amounts of cash? It's impossible, it can only add any one of the amounts you defined.
@NinjoOnline @TheDeadlyPanther It is running multiple times, I added a print line in there and it's repeated over and over in the output when it runs. I tried adding a debounce but the script just stopped working.