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)
The simple answer is you don't have anything to prevent it from copying again.
The long answer is to prevent the issue try this "if" statement:
if Enum.ProductPurchaseDecision.PurchaseGranted and receiptInfo.PlayerId == plr.userId and not game.Workspace.SharkPoint2:FindFirstChild("Megalodon") --Your code here end
If you have any questions or issues please contact me. ;)