Start building

Roblox Gamepass / VIP Door Script (Auto Purchase Prompt)

Checks if a touching player owns your Gamepass ID — if yes, lets them pass; if no, opens the official Roblox purchase prompt.

Type: ScriptExplorer: Inside your VIP Door PartLevel: Beginner
ScriptInside your VIP Door Part
-- Script inside the VIP Door Part
local Players = game:GetService("Players")
local MarketplaceService = game:GetService("MarketplaceService")

local GAMEPASS_ID = 0 -- Replace with your Gamepass ID
local door = script.Parent :: BasePart
local cooldown: { [number]: number } = {}

door.Touched:Connect(function(hit)
	local player = Players:GetPlayerFromCharacter(hit.Parent)
	if not player then return end
	if cooldown[player.UserId] and os.clock() - cooldown[player.UserId] < 3 then return end
	cooldown[player.UserId] = os.clock()

	local ok, owns = pcall(function()
		return MarketplaceService:UserOwnsGamePassAsync(player.UserId, GAMEPASS_ID)
	end)
	if ok and owns then
		door.CanCollide = false
		door.Transparency = 0.65
		task.delay(2.5, function()
			door.CanCollide = true
			door.Transparency = 0.2
		end)
	else
		MarketplaceService:PromptGamePassPurchase(player, GAMEPASS_ID)
	end
end)

How to install in Studio

  1. Create a glowing VIP door Part in Workspace (Anchored = true).
  2. Insert a Script inside that Part and paste the code.
  3. Replace GAMEPASS_ID = 0 with your real Gamepass numeric ID from Creator Hub.

Tips & customization

  • For per-player pass-through so non-owners can't sneak in behind a VIP, use PhysicsService CollisionGroups.

Common questions.

Why wrap UserOwnsGamePassAsync in pcall?

MarketplaceService makes a web request that can occasionally fail or throttle; pcall prevents the script from crashing.

More free Luau scripts.

All 16 scripts

Skip manual wiring.
Let Revix code & playtest it.

Start building free

Free to start. No card needed.