Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Multiple devproducts not working?

ok so this script right here give the player what they pay for and then the next it will give the what they previously purchased even if it was not that devproduct and then when you purchase any amount of devproducts afterward it gives you absolutely nothing just rips you off

script:

local Marketplaceservice = game:GetService("MarketplaceService")
local devid = 206197710 --1K
local devid2 = 278740243 --5K
local devid3 = 278740974 --10K
local devid4 = 278742122 --20K
local devid5 = 278742974 --50K
local devid6 = 278743396 --100K
local devid7 = 278760850 --200K
local devid8 = 278761364 --500K
local devid9 = 278761820 --1 Million
local devid10 = 278763424 --Donation
local bought = false
Marketplaceservice.ProcessReceipt = function(receiptinfo)
for i, player in ipairs(game.Players:GetChildren()) do
  if player.UserId == receiptinfo.PlayerId then

    if not bought then
      bought = true
      if receiptinfo.ProductId == devid then
        player.Nut.Coins.Value = player.Nut.Coins.Value + 1000
        bought = false
    end

    elseif receiptinfo.ProductId == devid2 then
      if not bought then
        bought = true
        player.Nut.Coins.Value = player.Nut.Coins.Value + 5000
        bought = false
      
    end


      elseif receiptinfo.ProductId == devid3 then
	    if not bought then
      bought = true
        player.Nut.Coins.Value = player.Nut.Coins.Value + 10000
        bought = false
      
    end


      elseif receiptinfo.ProductId == devid4 then
	    if not bought then
      bought = true
        player.Nut.Coins.Value = player.Nut.Coins.Value + 20000
        bought = false
      
    end


      elseif receiptinfo.ProductId == devid5 then
	    if not bought then
      bought = true
        player.Nut.Coins.Value = player.Nut.Coins.Value + 50000
        bought = false
      
    end


      elseif receiptinfo.ProductId == devid6 then
	    if not bought then
      bought = true
        player.Nut.Coins.Value = player.Nut.Coins.Value + 100000
        bought = false
      
    end


      elseif receiptinfo.ProductId == devid7 then
	    if not bought then
      bought = true
        player.Nut.Coins.Value = player.Nut.Coins.Value + 200000
        bought = false
      
    end


      elseif receiptinfo.ProductId == devid8 then
	    if not bought then
      bought = true
        player.Nut.Coins.Value = player.Nut.Coins.Value + 500000
        bought = false
      
    end


      elseif receiptinfo.ProductId == devid9 then
	    if not bought then
      bought = true
        player.Nut.Coins.Value = player.Nut.Coins.Value + 1000000
        bought = false
      
    end

   
      elseif receiptinfo.ProductId == devid10 then
	    if not bought then
      bought = true
        player.Nut.Coins.Value = player.Nut.Coins.Value + 4000
        bought = false
      
    end

  end
end
end
end

1 answer

If you don't return Enum.ProductPurchaseDecision.PurchaseGranted from the ProcessReceipt handler, Roblox will consider the product not yet granted, and it will keep sending you the receipt for this transaction (for up to 3 days I think), after which it will refund the buyer.

If for some reason you need to defer processing the transaction deliberately, you should return Enum.ProductPurchaseDecision.NotProcessedYet explicitly so that you can easily follow the code logic, rather than just letting the function return no value (even though NotProcessedYet has the same result).

You're not returning any value, ever, which has the effect of refusing to acknowledge any purchases.

1 comment

0

thank you i tried adding this right after the if player userid == receipt then but it doesnt do anything now

This discussion is preserved as it was. New answers, comments, and votes are closed.