How do I check if a user has a game pass when a proximity prompt is fired, and if they don’t have it, prompt them to buy it?
For future reference, try and attempt it yourself before asking for help.
01 | local Prompt = script.Parent |
02 | local MPS = game:GetService( 'MarketplaceService' ) |
03 | local gamepassID = 0 -- change to your gamepass |
04 |
05 | Prompt.Triggered:Connect( function (Player) |
06 | if MPS:UserOwnsGamepassAsync(Player.UserId, gamepassID) |
07 | -- do stuff |
08 | else |
09 | MPS:PromptGamePassPurchase(Player, gamepassID) |
10 | end -- gamepass own check |
11 | end ) -- onTriggered |
Sources: