Why does my dev product buy multiple times after I buy it once?
I have a game and the currency is called LiBux and I have a gui that when you click it a dev product shows up to buy it. When you buy it, it gives you +1 LiBux. When you buy it agian it gives you +2. When you buy it again you get +3 and so on. Why does it do this? I want it to be when you buy it you only get +1.
Here is the script in the TextButton
1 | local button = script.Parent |
4 | button.MouseButton 1 Click:connect( function () |
5 | game:GetService( 'MarketplaceService' ):PromptProductPurchase(game.Players.LocalPlayer, id) |
here is the script in ServerScriptService
01 | local MarketplaceService = game:GetService( "MarketplaceService" ) |
04 | MarketplaceService.ProcessReceipt = function (receiptInfo) |
05 | for i, player in ipairs (game.Players:GetChildren()) do |
06 | if player.userId = = receiptInfo.PlayerId then |
07 | if receiptInfo.ProductId = = id then |
09 | player.leaderstats.LiBux.Value = player.leaderstats.LiBux.Value + 1 |