How To Make a Gamepass Button in Roblox: Step‑by‑Step Guide

Adding a gamepass button to your Roblox experience can boost revenue and give players exclusive perks. This tutorial walks you through creating a functional button, linking it to a gamepass, and testing it in Play Solo. Follow each section for a clear, script‑free setup that works on both mobile and desktop.

1. Prepare the Gamepass in the Roblox Catalog

Before you place a button in‑game, you need a gamepass ID. Open the Develop page on the Roblox website, select Game Passes, and click Create New Game Pass. Upload an image, set a name, and define the price. After publishing, copy the numeric ID from the URL – you’ll need it later.

2. Insert a UI Button into Your Game

Open Roblox Studio and load the place where you want the button to appear. In the Explorer panel, right‑click StarterGui and choose ScreenGui. Inside the new ScreenGui, insert a TextButton. Rename it to GamepassButton and adjust the Size, Position, and Text properties so it matches your game’s style.

3. Add a LocalScript to Handle Clicks

With the button selected, click Insert Object and add a LocalScript**. This script runs on the player’s device, ensuring a smooth UI response. Paste the following code, replacing YOUR_GAMEPASS_ID with the ID you copied earlier:

  1. local button = script.Parent
  2. local gamepassId = YOUR_GAMEPASS_ID
  3. local MarketplaceService = game:GetService("MarketplaceService")
  4. button.MouseButton1Click:Connect(function()
  5. local player = game.Players.LocalPlayer
  6. local success, ownsPass = pcall(function()
  7. return MarketplaceService:UserOwnsGamePassAsync(player.UserId, gamepassId)
  8. end)
  9. if success and ownsPass then
  10. -- Grant the perk (example: give a special tool)
  11. print("Player already owns the gamepass.")
  12. else
  13. MarketplaceService:PromptGamePassPurchase(player, gamepassId)
  14. end
  15. end)