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
local button = script.Parent local id = 269243771 button.MouseButton1Click:connect(function() game:GetService('MarketplaceService'):PromptProductPurchase(game.Players.LocalPlayer, id) end)
here is the script in ServerScriptService
local MarketplaceService = game:GetService("MarketplaceService") local id = 269243771 MarketplaceService.ProcessReceipt = function(receiptInfo) for i, player in ipairs(game.Players:GetChildren()) do if player.userId == receiptInfo.PlayerId then if receiptInfo.ProductId == id then player.leaderstats.LiBux.Value = player.leaderstats.LiBux.Value + 1 end end end end
Uhhh, Maybe try X + 1 and set the value of X to 0 by doing x = 0 I am not an expert or anything I'm just trying to help :P