Say I have a product that gives you 500 cash. I use to cash to purchase an in-game item. But when you come back on, you have 500 cash again.
local MarketPlace = game:GetService("MarketplaceService")
local DataStore = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
local ProductID = 22492584
MarketPlace.ProcessReceipt = function(ReceiptInfo)
for i, player in ipairs(game.Players:GetChildren()) do
if player.userId == ReceiptInfo.PlayerId then
if ReceiptInfo.ProductId == ProductID then
player.Cash.Value = player.Cash.Value + 500
end
end
end
local playerProductKey = "player_" .. ReceiptInfo.PlayerId .. "_purchase_" .. ReceiptInfo.PurchaseId
DataStore:IncrementAsync(playerProductKey, 1)
return Enum.ProductPurchaseDecision.PurchaseGrant
end

2 comments
Simply use game passes?
Oh sorry , I misread the thing.