So I know how to prompt the purchase, and I know how to check if someone has it. But how do I check if someone bought it after the prompt purchase?
You will have to check whether the gamepass /product own is true so you could do something like this
1 | local hasPass = false |
2 |
3 | -- Check if the player already owns the game pass |
4 | local success, message = pcall ( function () |
5 | hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, gamePassID) |
6 | end ) |
1 | local market = game:GetService( "MarketplaceService" ) |
2 | local plr = game:GetService( "Players" ).LocalPlayer |
3 | local gamepass = 0 --change to your gamepass ID |
4 |
5 | if market:PlayerOwnsAssest(plr, gamepass) then |
6 | --put in the script where the player owns it |
7 | else |
8 | game:GetService( "MarketplaceService" ):PromptPurchase(game.Players.LocalPlayer, gamepass) |
9 | end |