Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Multiple PromptPurchases in a row help?

Asked by
NotSoNorm 777 Moderation Voter
8 years ago

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

Log in to vote
0
Answered by
NotSoNorm 777 Moderation Voter
8 years ago

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)
Ad

Answer this question