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:
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
--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--
--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)
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)
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.
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