Hello everyone,

So I have a GUI with a button that fires something when a gamepass has been purchased.

What do I want to achieve?

How do I make sure a purchase has been bought through a PromptGamePassPurchase so it fires something after it has been bought? So for example, a player got a prompt purchase and bought it successfully. What's the command (how to script) to see whether he bought it so the player can get his/her reward?

What's the issue?

Currently, it only gives the prompt purchase but keeps repeating it. When rejoining the game, it finally fires the command. I want it directly to happen when it has been purchased instead of rejoining to prevent further confusions of buying it again.

Solutions I tried so far

I've looked through this: https://developer.roblox.com/api-reference/callback/MarketplaceService/ProcessReceipt, but I still don't understand really.

I currently have this:

if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(Player.userId, ID) then
    print("Player has the GamePass, continue on")
else
    game:GetService("MarketplaceService"):PromptGamePassPurchase(Player,ID) -- buy the product first then proceed
    -- >>a command to make sure the player bought it<<
   print("Player has succesfully bought the gamepass, continue second command")
end

Thanks in advance! ~snewo12

4 comments

0

what?

0

a boolValue is a true or false value. I think they mean make a value for checking if the player bought it or not (like boughtTool would be set to false if the player didnt buy the gamepass)

0

....?