How to prevent duplicated developer product item spawns upon purchase?

  1. What do you want to achieve?
    Make developer product item spawn one time per purchase.

  2. What is the issue?
    The script spawns an item as many times I have clicked the button to purchase.
    Example: If I purchase 1 time only 1 appears, if I purchase a 2nd time 2 items appear instead of 1 and then 3 and so on.

  3. **What solutions have you tried so far?**Variations of the code and research.


local MPS = game:GetService("MarketplaceService")
local id = 1566979635

Button.MouseClick:Connect(function(Player)
	MPS:PromptProductPurchase(Player, id) 
	MPS.ProcessReceipt = function(receiptinfo) 
	if receiptinfo.ProductId == id then
			respawnCube()
			end
		end
end)

1 Like

Okay, first of all, try using a central script to handle your dev product purchasing, as dev products only accept 1 function. Second, are you connecting the MouseClick event more than once, if so I would recommend disconnecting it once you are done. Additionally, make sure that the player purchasing the product is actually the player you are targeting.


A screenshot from this page.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.