Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Multiple PromptPurchases in a row help?

Now I have 3 ID's in this table, it prompts me with 2 of them but not the third. Why?

No errors

local MarketplaceService = game:GetService("MarketplaceService")
script.Parent.Events.PurchaseAudios.OnServerEvent:connect(function(player, name)
	for _,v in next,tableofids do
		MarketplaceService:PromptPurchase(player, v) --promt player
		MarketplaceService.PromptPurchaseFinished:connect(function(player, assetId, isPurchased) end) --Yeild till finished?
		wait(1)
	end
end)

1 answer

I got it, apparently just doing MarketplaceService.PromptPurchaseFinished:connect(function(player, assetId, isPurchased) doesn't yield, I'll keep this here for reference's sake

local MarketplaceService = game:GetService("MarketplaceService")
script.Parent.Events.PurchaseAudios.OnServerEvent:connect(function(player, name)
	for _,v in next,tableofids do
		local finished = false
		MarketplaceService:PromptPurchase(player, v) --promt player
		MarketplaceService.PromptPurchaseFinished:connect(function(player, assetId, isPurchased) finished = true end) --Yeild till finished?
		repeat wait() until finished == true
		wait(1)
	end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.