Gamepass Button

So i am currently in the middle of making a game, and I was wanting to add a game pass button for items that you can click and purchase in-game. Example:


I have no idea where to start any help or videos would be helpfull. Thanks for reading!

2 Likes

If you want something like that example, use a ClickDetector | Roblox Creator Documentation, and use ClickDetector | Roblox Creator Documentation to detect when the click detector is activated. Once it is activated, use MarketplaceService | Roblox Creator Documentation to prompt a gamepass purchase. And your basically done.

Also, parent the ClickDetector to the Part/Model/Folder that you want to be clicked.

Bababooey

1 Like

you need to create the gamepass first
also it would be in the local script

local player = game.Players.LocalPlayer
local gamepassid = --add gamepass Id

if game.MarketplaceService:UserOwnsGamePassAsync(player.UserId, gamepassid) then
–Do something here
end

script.Parent.MouseButton1Click:Connect(function()
game:GetService(“MarketplaceService”):PromptGamePassPurchase(game.Players.LocalPlayer, gamepassId)
end)

What? You are also able to process the gamepass purchase server-sided as well, right…? Unless if you meant to reply to the OP? Also you need to check for a PromptGamePassPurchasedFinished Event, your script doesn’t have that

So, I just put the gear into replicated storage and make a gamepass get the id then what?

I believe so, just make sure to Parent everything the correct way so it works :thinking: