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

Can I detect when a purchase is completed?

Asked by 5 years ago

Hi! I'm making a shop GUI. I want something to happen when a gamepass purchase is either canceled, or completed. Is there any way to detect this?

0
Look under the events in MarketplaceService. xPolarium 1388 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

You would be using the PromptGamePassPurchasedFinished event of the MarketplaceService. It should be handled on the server.

local MarketplaceService = game:GetService("MarketplaceService")
local ID = 0000000009 -- put your id here 

local onFinish

onFinish = function(player, passId, isPurchased)
    if passId == ID then -- check if id
        if isPurchased then -- if they purchased it, not click cancel
            -- code
        else
            print("Not bought")
        end
    end
end

MarketplaceService.PromptGamePassPurchaseFinished:Connect(onFinish)
0
Oh, I completely forgot about that. Thanks! Microwosoft 7 — 5y
Ad

Answer this question