I’m having this problem when a player buys a developer product and the DataStore2 module increments double each time you purchase.
Example: the first time I buy a 100 Cash product and get 100
the second time I buy a 100 Cash product and get 200
it keeps on doubling each purchase.
Scripts:
Product Manager:
local MPS = game:GetService("MarketplaceService")
local DataStore2 = require(1936396537)
local Products = {
[100] = 1273371645,
[300] = 1273371646,
[500] = 1273371644,
[800] = 1273371643,
}
MPS.ProcessReceipt = function(receiptInfo)
local Player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
local SpeedDataStore = DataStore2("Speed", Player)
if receiptInfo.ProductId == 1273371645 then
SpeedDataStore:Increment(100, 0)
elseif receiptInfo.ProductId == 1273371646 then
SpeedDataStore:Increment(300, 0)
elseif receiptInfo.ProductId == 1273371644 then
SpeedDataStore:Increment(500, 0)
elseif receiptInfo.ProductId == 1273371643 then
SpeedDataStore:Increment(800, 0)
end
end
and the buy script:
local Products = require(script.Parent.Parent.Parent.Parent.Parent.Products)
local Player = game.Players.LocalPlayer
local MPS = game:GetService("MarketplaceService")
script.Parent.MouseButton1Click:Connect(function()
MPS:PromptProductPurchase(Player, Products[100])
end)
How could i fix this?