Adding a carpet from the gamepass section

So what im trying to do is very simple: I want the user to get prompted a gamepass when the touch a block. Here’s what i’ve got so far. It isn’t much, and I think it’s wrong too, because its my first time doing this type of thing.

local MP = game:GetService("MarketplaceService")

Again, I don’t know if this is the correct variable. Do I get the market place and then put the id of the gamepass somewhere? Please help if you can. Thanks for reading! :smile:

Yes, you do need to store the gamepass ID with the script. It will not work without the gamepass ID stored inside the script in which you want the gamepass to show up. You have to have an ID for almost every marketplace service, otherwise it won’t show up.

Like this:

   local Id = **gamepass id**

You’d need to fire a touched event when a player has touched the part, then afterwards, you’d want to prompt them by using MP:PromptPurchase(plr, id) - MarketplaceService | Documentation - Roblox Creator Hub. If it’s a gamepass, you’d replace PromptPurchase with PromptGamePassPurchase.