so i have my purchase handler script that when a player purchases one of my devproducts they are only able to purchase it once, if they purchase it more than once it will steal their robux and they dont get anything in return
i used to have it without debounce and every if except the first was elseif and that worked fine but every time someone would purchase something it would give them what they paid for plus what they purchase before say they purchase 1000 then purchase 1000 again they get 2000 and if they purchase again they get 3000 and so on and i think nomatter what they purchases it could be 1 million but if they purchased 1000 right before that they would get 2000
so yeah im really struggling here just to get something really simple to work
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
end
if receiptinfo.ProductId == devid2 then
if not bought then
bought = true
player.Nut.Coins.Value = player.Nut.Coins.Value + 5000
bought = false
end
end
if not bought then
bought = true
if receiptinfo.ProductId == devid3 then
player.Nut.Coins.Value = player.Nut.Coins.Value + 10000
bought = false
end
end
if not bought then
bought = true
if receiptinfo.ProductId == devid4 then
player.Nut.Coins.Value = player.Nut.Coins.Value + 20000
bought = false
end
end
if not bought then
bought = true
if receiptinfo.ProductId == devid5 then
player.Nut.Coins.Value = player.Nut.Coins.Value + 50000
bought = false
end
end
if not bought then
bought = true
if receiptinfo.ProductId == devid6 then
player.Nut.Coins.Value = player.Nut.Coins.Value + 100000
bought = false
end
end
if not bought then
bought = true
if receiptinfo.ProductId == devid7 then
player.Nut.Coins.Value = player.Nut.Coins.Value + 200000
bought = false
end
end
if not bought then
bought = true
if receiptinfo.ProductId == devid8 then
player.Nut.Coins.Value = player.Nut.Coins.Value + 500000
bought = false
end
end
if not bought then
bought = false
if receiptinfo.ProductId == devid9 then
player.Nut.Coins.Value = player.Nut.Coins.Value + 1000000
bought = false
end
end
if not bought then
bought = false
if receiptinfo.ProductId == devid10 then
player.Nut.Coins.Value = player.Nut.Coins.Value + 4000
bought = false
end
end
end
end
end

2 comments
You want them to only be able to purchase a devproduct once? Or do you want them to be able to purchase them multiple times?
No. Dev products players can buy multiple times, but gamepass they cant, only one time.