Im currently trying to add a gamepass to my game and make it automatically check if the player has bought it after the gamepass prompt closed.
Im not good in explaining but I’ll try;
Gamepass prompt shows
Player buys it
Game checks automatically if player bought it or not
If bought, give player reward (I will obviously code this part myself)
I dont have any idea how I can code that, this is what I’ve got right now in a local script:
script.Parent.MouseButton1Click:Connect(function()
game:GetService("MarketplaceService"):PromptGamePassPurchase(game.Players.LocalPlayer, 26733577)
-- How do I check if player bought gamepass after the prompt?
end)
Connect a function to MarketplaceService.PromptGamePassPurchaseFinished.
MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, gamePassId, wasPurchased)
if gamePassId == myGamePassId and wasPurchased then
print("The gamepass was prompt was completed and the gamepass purchased")
end
end)