Confetti Cannon Dev Product Script Not Working

Hey! So I’m making a system where when you click a part, it prompts a dev product purchase. Once the purchase is completed, all the particle emitters under the confetti parts will be enabled for 15 seconds, then disable. Here is what I got:


That script is here:
image
Then here are the confetti parts, each one has 5 particle emitters.
image

The script will prompt the purchase correctly, but it doesn’t enable any of the confetti cannons. Can someone help?

as i am seeing in your for i, v loops what i saw is this:

 if V:IsA("ParticleEmitter") then
v.Enabled = true
wait(15)    ------ this is the part that is bugging
v.Enabled = false
end

soo when you are doing a for i v loop is that its getting this particle emiter it will turn it on and wait 15 then turn it off which then proceed to anonther particle which will do the same thing and do it again till it reach the final particle emitter soo better one is to do this:

for _,v in pairs(workspace.ConfettiParts:GetDescendants()) do
 if V:IsA("ParticleEmitter") then
v.Enabled = true
    end    
end
  wait(15)
 for _,v in pairs(workspace.ConfettiParts:GetDescendants()) do
   if V:IsA("ParticleEmitter") then
       v.Enabled = false
    end    
end

This is what I have now, I tried it and it prompted the purchase but after I purchased it, nothing happened.

can you paste the script if u can please

--Services--
local MarketplaceService 		= game:GetService("MarketplaceService")

--Integer Defintions--
local AssetID 					= 1153097919

--Objects--
local Part						= script.Parent
local ClickDetector				= Part.ClickDetector


--Events--
ClickDetector.MouseClick:Connect(function(Player)
	MarketplaceService:PromptProductPurchase(Player, AssetID)
end)


MarketplaceService.PromptPurchaseFinished:Connect(function(Player, AssetID, Purchased)
	print("le swo")
	
	if Purchased then
		for _,v in pairs(workspace.CondettiParts:GetDescendants()) do
			if v:IsA("ParticleEmitter") then
				v.Enabled = true
			end    
		end
		wait(15)
		for _,v in pairs(workspace.CondettiParts:GetDescendants()) do
			if v:IsA("ParticleEmitter") then
				v.Enabled = false
			end    
		end
	end            
end)

--End of Events--
1 Like

the script says CondettiParts, is that the correct name for the emitters?

Omg lol, no that’s not right let me take a look :skull:

my big bad i couldnt wrote these word well

This is what I have now, still doesn’t work.

--Services--
local MarketplaceService 		= game:GetService("MarketplaceService")

--Integer Defintions--
local AssetID 					= 1153097919

--Objects--
local Part						= script.Parent
local ClickDetector				= Part.ClickDetector


--Events--
ClickDetector.MouseClick:Connect(function(Player)
	MarketplaceService:PromptProductPurchase(Player, AssetID)
end)


MarketplaceService.PromptPurchaseFinished:Connect(function(Player, AssetID, Purchased)
	print("le swo")
	
	if Purchased then
		for _,v in pairs(workspace.ConfettiParts:GetDescendants()) do
			if v:IsA("ParticleEmitter") then
				v.Enabled = true
			end    
		end
		wait(15)
		for _,v in pairs(workspace.ConfettiParts:GetDescendants()) do
			if v:IsA("ParticleEmitter") then
				v.Enabled = false
			end    
		end
	end            
end)

it should work are you sure the asset id is correct

Yes, it prompts the purchase correctly. Just after the purchase is completed nothing happens.

Make sure the properties of the confetti parts are right? idk like “enabled” or something

maybe try putting an else which will return end when purchase is not complete

 MarketplaceService.PromptPurchaseFinished:Connect(function(Player, AssetID, Purchased)
	print("le swo")
	
	if Purchased then
		for _,v in pairs(workspace.ConfettiParts:GetDescendants()) do
			if v:IsA("ParticleEmitter") then
				v.Enabled = true
			end    
		end
		wait(15)
		for _,v in pairs(workspace.ConfettiParts:GetDescendants()) do
			if v:IsA("ParticleEmitter") then
				v.Enabled = false
			end    
		end
    else
      return
	end            
end)

Still doesn’t work, idk what else to try

I believe inorder to do something when the player purchases a dev product, you use the processreceipt callback given to MarketplaceService.

More info: https://developer.roblox.com/en-us/api-reference/callback/MarketplaceService/ProcessReceipt.

Perhaps try

local function processinfo(receiptInfo)
	print("le swo")
	
	if receiptInfo.ProductId == AssetID then
		for _,v in pairs(workspace.ConfettiParts:GetDescendants()) do
			if v:IsA("ParticleEmitter") then
				v.Enabled = true
			end    
		end
		wait(15)
		for _,v in pairs(workspace.ConfettiParts:GetDescendants()) do
			if v:IsA("ParticleEmitter") then
				v.Enabled = false
			end    
		end
	end  

	return Enum.ProductPurchaseDecision.PurchaseGranted
end

MarketplaceService.ProcessReceipt = processinfo

Instead of the PromptPurchaseFinished code, which is used for something else.

Nope still nothing, I really have no idea why it’s not working.

The print isn’t working either?

Nope, nothing in output.

This is bc there is a 30 letter minimum lol

Just to be clear, are there any other scripts that contain the Processreceipt callback? Asking this since ProcessReceipt can only be set by one script.

If it’s the only processreceipt there, perhaps you could just maek the script i nthe part prompt the product but put the code to run stuff when a product was bought somewhere like ServerScriptService

Do you have another script that receives the receipt event?