local MPService = game:GetService("MarketplaceService") MPService.ProcessReceipt = function(purchasInfo) local plr = game:GetService("Players"):GetPlayerByUserId(purchasInfo.PlayerId) if purchasInfo.ProductId == 989677509 then plr.leaderstats.Money.Value = plr.leaderstats.Money.Value * 2 end end
this is what I have, but when you buy the product a second time, the money multiplies by 4, 8, 16, and so on. How could you fix this?
Edit: It also seems to be printing a value twice, four times, and eight times, depending on how many times you've bought product
Edit 2: this multiplication issue seems to only persist with a dev product
local MPService = game:GetService("MarketplaceService") local origcash = nil MPService.ProcessReceipt = function(purchaseInfo) local plr = game:GetService("Players"):GetPlayerByUserId(purchaseInfo.PlayerId) if purchaseInfo.ProductId == 989677509 then origcash = plr.leaderstats.Money.Value plr.leaderstats.Money.Value = plr.leaderstats.Money.Value + origcash wait(.4) origcash = nil end return Enum.ProductPurchaseDecision.PurchaseGranted end
That Should Work. Also Don't Use *2 Because If The Game Lags Then The Player Will Gets Tons Of Cash.