At this point I think its a roblox bug, but when I spam click my buy button, or the roblox buy button, or even when I buy dev products multiple times without spamming I start to get extra cash. I'm using datastores to record purchases, I've tried to save it in a table and saving it in a seperate key but when I check if the purchase id is the same as the purchase id saved in the datastore, it doesnt print out the message its supposed to. I'm using numbervalues to store my cash (if that matters).
Server Script:
marketPlaceService.ProcessReceipt = function(recieptInfo) local playerId = recieptInfo.PlayerId local productId = recieptInfo.ProductId local purchaseId = recieptInfo.PurchaseId local player = game.Players:GetPlayerByUserId(playerId) local purchaseKey = playerId .. '_' .. purchaseId local cashPurchaseData = purchaseLogDataStore:GetAsync(purchaseKey) if not player then print('Product already bought') return Enum.ProductPurchaseDecision.NotProcessedYet end if cashPurchaseData then return Enum.ProductPurchaseDecision.PurchaseGranted end --[[for i, v in pairs(cashPurchaseData) do print(v) print(purchaseId) if v == purchaseId then print('Purchase already completed') return Enum.ProductPurchaseDecision.PurchaseGranted end end--]] if productId == oneHundredKProductId then player.Money.Value = player.Money.Value + 100000 elseif productId == fiveHundredKProductId then player.Money.Value = player.Money.Value + 500000 elseif productId == oneMProductId then player.Money.Value = player.Money.Value + 1000000 elseif productId == fiveMProductId then player.Money.Value = player.Money.Value + 5000000 elseif productId == tenMProductId then player.Money.Value = player.Money.Value + 10000000 end playerStatsDataStore:SetAsync(playerId .. '_cash', player.Money.Value) --table.insert(cashPurchaseData, purchaseId) purchaseLogDataStore:SetAsync(purchaseKey, true) print('Purchase Finished') -- This prints less times than the amount of cash I'm supposed to get with each purchase return Enum.ProductPurchaseDecision.PurchaseGranted end
Local Script:
marketPlaceService:PromptProductPurchase(player, selectedProduct) wait(1) - debounce = false -- I've added a debounce before this.