The script below is supposed to spawn one object once the dev product has been purchased. When you buy the dev product the first time, it will spawn once as it should. But when you buy the dev product again it will spawn two at once instead of one.
local link = game:GetService("MarketplaceService")
deb = 0
script.Parent.ClickDetector.MouseClick:Connect(function(plr)
local marketId = 377473848 --ID OF YOUR DEVELOPER PRODUCT
if deb == 0 then
deb = 1
link:PromptProductPurchase(plr,marketId)
link.ProcessReceipt = function(receiptInfo)
if Enum.ProductPurchaseDecision.PurchaseGranted and receiptInfo.PlayerId == plr.userId then
local megalodon = game:GetService("ServerStorage").Megalodon:Clone()
megalodon.Parent = game.Workspace
megalodon:MakeJoints()
megalodon:MoveTo(workspace.SharkPoint2.Position)
wait(1)
deb = 0
end
end
end
end)

2 comments
Is that during a game if you bought twice or different servers?
The first time you buy it, it will spawn once. Buying it more than once will cause it to spawn two at a time