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

How do I get if the sale has completed?

Asked by
DBoi941 57
5 years ago

I have been using this in game to prompt the purchase but what I would like to do is fire a GUI to open if the sale completed.

local shirtId = 0000000000

script.Parent.ClickDetector.MouseClick:connect(function(player)
game:GetService("MarketplaceService"):PromptPurchase(player, shirtId)
end)

1 answer

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

You can use MarketplaceService.PromptPurchaseFinished to know when the player purchases a shirt that you prompted in-game.

local shirtId = 0000000000

script.Parent.ClickDetector.MouseClick:connect(function(player)
    local MarketplaceService = game:GetService("MarketplaceService")
    MarketplaceService:PromptPurchase(player, shirtId)
    MarketplaceService.PromptPurchaseFinished:Connect(function(buyer,assetId,isPurchased) 
        if assetId == shirtId and buyer.UserId == player.UserId then
            -- Do something
        end
    end)
end)
1
Thank you very much. DBoi941 57 — 5y
0
No problem! DirectorDexter 69 — 5y
Ad

Answer this question