Users can buy the game pass to unlock permanent access to exclusive content and features, available for a lifetime.
Create Game Pass
https://create.roblox.com/
>Dashboard
>Creations
>My Experiences
>[Your Game]
Roblox Studio
Passes
>Create A Pass
>[Enter Details]
>Create Pass
Roblox Studio
Back to Game Pass Page
>Click the Created Pass
>Sales
>[Enter Details]
>Save Changes
Roblox Studio
Back to Game Pass Page
>Copy Asset ID
Roblox Studio
Initiate Purchase
Empty
Empty
Empty
local passID = YOUR_GAME_PASS_ID  
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
-- Next Slide: checkAndPromptPurchase(player)
game.Workspace:WaitForChild("PassCheck"):WaitForChild("SurfaceGui"):WaitForChild("Purchase").Activated:Connect(
    function()
        local player = Players.LocalPlayer
        checkAndPromptPurchase(player)
    end
)
	
local function checkAndPromptPurchase(player)
    local hasPass = false
    local success, message = pcall(function()
        hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, passID)
    end)
    if not success then
        warn("Error while checking if player has pass: " .. tostring(message))
        return
    end
    if hasPass then
        -- Player already owns the Pass; you can display a message or take another action
        print("You already own the Game Pass!")
    else
        -- Player does NOT own the Pass; prompt them to purchase
        MarketplaceService:PromptGamePassPurchase(player, passID)
    end
endGrant Privilege on Game Pass Purchase
Empty
Empty
Empty
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local passID = YOUR_GAME_PASS_ID  
local function onPromptPurchaseFinished(player, purchasedPassID, purchaseSuccess)
	if purchaseSuccess and purchasedPassID == passID then
		-- logic for Game Pass
	end
end
MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(userId, purchasedPassID, purchaseSuccess)
	local player = Players:GetPlayerByUserId(userId)
	if player then
		onPromptPurchaseFinished(player, purchasedPassID, purchaseSuccess)
	end
end)Grant Privilege on Player Join
Empty
Empty
Empty
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local passID = YOUR_GAME_PASS_ID  
local function onPlayerAdded(player)
	local hasPass = false
	-- Check if the player owns the Game Pass
	local success, message = pcall(function()
		hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, passID)
	end)
	if not success then
		warn("Error checking pass ownership: " .. tostring(message))
		return
	end
	if hasPass then
		-- logic for Game Pass
	end
end
Players.PlayerAdded:Connect(onPlayerAdded)If you found this tutorial helpful and would like to support my work, please consider buying me a coffee.
Thank you very much for your support!
Buy me a coffee




