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

1local button = script.Parent
2local id = 269243771
3 
4button.MouseButton1Click:connect(function()
5    game:GetService('MarketplaceService'):PromptProductPurchase(game.Players.LocalPlayer, id)
6end)

here is the script in ServerScriptService

01local MarketplaceService = game:GetService("MarketplaceService")
02local id = 269243771
03 
04MarketplaceService.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
08 
09    player.leaderstats.LiBux.Value = player.leaderstats.LiBux.Value + 1
10   end
11  end
12 end
13end
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