Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Why does my dev product buy multiple times after I buy it once?

Asked by 6 years ago

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
0
You don't return a result in ProcessReceipt Amiaa16 3227 — 6y
0
can you give me an example in answers section? blocky010101 23 — 6y

1 answer

Log in to vote
-1
Answered by
sed44 2
6 years ago

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

Ad

Answer this question