In short
Tag the door part VipDoor. In a Script in ServerScriptService, register two collision groups, make them not collide, and put the door in one. When a player joins, call MarketplaceService:UserOwnsGamePassAsync(player.UserId, passId) inside pcall; if they own the pass, put every part of their character in the other group, so they walk through and everyone else bumps into it. Grant new buyers from PromptGamePassPurchaseFinished on the server. A LocalScript opens the purchase window when a non-owner touches the door.
- Collision groups work per part, so the door is solid for some characters and open for others without any per-player copies.
- Check ownership on the server. A LocalScript that makes the door non-collidable only on the owner's device can be copied by any exploiter.
- An exploiter controls their own character and can walk through any wall, so if the room holds something valuable, the server also checks who is inside it (Step 4).
Get the script
VIP game pass door script
A server Script that checks the VIP pass when players join and when they buy it, lets owners walk through doors tagged VipDoor with collision groups, and moves non-owners out of the VIP room.
-- Script in ServerScriptService named VipDoorServer.
-- Only VIP pass owners walk through parts tagged VipDoor. Non-owners inside VipArea parts are moved out.
local CollectionService = game:GetService("CollectionService")
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local VIP_PASS_ID = 0 -- your pass ID from Creator Hub
local TEST_AS_OWNER = false -- true = everyone counts as an owner, in Studio only
local GUARD_SECONDS = 1 -- how often non-owners are checked inside VipArea parts
local CHECK_ATTEMPTS = 3
local DOOR_GROUP = "VipDoor"
local OWNER_GROUP = "VipPlayers"
-- The two groups pass through each other; everything else collides as normal
for _, groupName in { DOOR_GROUP, OWNER_GROUP } do
if not workspace:IsCollisionGroupRegistered(groupName) then
workspace:RegisterCollisionGroup(groupName)
end
end
workspace:CollisionGroupSetCollidable(DOOR_GROUP, OWNER_GROUP, false)
local function setUpDoor(door: Instance)
if door:IsA("BasePart") then
door.CollisionGroup = DOOR_GROUP
-- The LocalScript reads this to open the right purchase window
door:SetAttribute("VipPassId", VIP_PASS_ID)
end
end
for _, door in CollectionService:GetTagged("VipDoor") do
setUpDoor(door)
end
CollectionService:GetInstanceAddedSignal("VipDoor"):Connect(setUpDoor)
local owners: { [Player]: boolean } = {}
local function putInGroup(character: Model)
for _, part in character:GetDescendants() do
if part:IsA("BasePart") then
part.CollisionGroup = OWNER_GROUP
end
end
end
local function grant(player: Player)
if owners[player] then
return
end
owners[player] = true
player:SetAttribute("OwnsVip", true)
if player.Character then
putInGroup(player.Character)
end
end
local function ownsPass(player: Player): boolean
if TEST_AS_OWNER and RunService:IsStudio() then
return true
end
if VIP_PASS_ID == 0 then
return false
end
for attempt = 1, CHECK_ATTEMPTS do
local ok, result = pcall(function()
return MarketplaceService:UserOwnsGamePassAsync(player.UserId, VIP_PASS_ID)
end)
if ok then
return result == true
end
warn("VIP check failed for " .. player.Name .. " (try " .. attempt .. "): " .. tostring(result))
task.wait(2 ^ attempt)
end
return false
end
local function onPlayerAdded(player: Player)
player:SetAttribute("OwnsVip", false)
-- New characters (and accessories that load late) join the owner group
player.CharacterAdded:Connect(function(character: Model)
if owners[player] then
putInGroup(character)
character.DescendantAdded:Connect(function(part: Instance)
if part:IsA("BasePart") then
part.CollisionGroup = OWNER_GROUP
end
end)
end
end)
if ownsPass(player) and player.Parent == Players then
grant(player)
end
end
Players.PlayerAdded:Connect(onPlayerAdded)
for _, player in Players:GetPlayers() do
task.spawn(onPlayerAdded, player)
end
Players.PlayerRemoving:Connect(function(player: Player)
owners[player] = nil
end)
-- Bought during this session: the server's event is the one to trust
MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player: Player, passId: number, wasPurchased: boolean)
if wasPurchased and passId == VIP_PASS_ID then
grant(player)
end
end)
-- The VIP room guard: non-owners inside a VipArea part are moved to the VipExit part
local function isInside(area: BasePart, position: Vector3): boolean
local offset = area.CFrame:PointToObjectSpace(position)
local half = area.Size / 2
return math.abs(offset.X) <= half.X and math.abs(offset.Y) <= half.Y and math.abs(offset.Z) <= half.Z
end
while true do
task.wait(GUARD_SECONDS)
local areas = CollectionService:GetTagged("VipArea")
local exit = CollectionService:GetTagged("VipExit")[1]
if #areas > 0 then
for _, player in Players:GetPlayers() do
local character = player.Character
local root = character and character:FindFirstChild("HumanoidRootPart")
if not owners[player] and character and root and root:IsA("BasePart") then
for _, area in areas do
if area:IsA("BasePart") and isInside(area, root.Position) then
if exit and exit:IsA("BasePart") then
character:PivotTo(exit.CFrame + Vector3.new(0, 3, 0))
else
-- No exit part: respawn them instead
task.spawn(function()
player:LoadCharacterAsync()
end)
end
break
end
end
end
end
end
end
RoCode builds it in the place you have open in Roblox Studio, on Windows or macOS with a desktop browser; on a phone the button sends the prompt and the link to your computer. Free to start, with free credits every day. More Roblox Studio scripts
Where to put it
ServerScriptService
VipDoorServer Script new
StarterPlayer
StarterPlayerScripts
VipDoorClient LocalScript new
Workspace
VipDoor Part (tag: VipDoor)
VipArea Part (tag: VipArea, optional)
VipExit Part (tag: VipExit, optional)
Settings you can change
VIP_PASS_IDIn the script- Your pass ID from Creator Hub. At 0 nobody owns it, except in Studio with TEST_AS_OWNER. Default:
0. TEST_AS_OWNERIn the script- Set to
trueto be treated as an owner in Studio only, to try the door. It does nothing on live servers. Default:false. GUARD_SECONDSIn the script- How often the server checks for non-owners inside VipArea parts. Default:
1.
Create the pass and copy its ID first (Step 1). The buy prompt is in the VipDoorClient LocalScript (Step 3), which reads the ID from the door.
What a cheater can and cannot doOwnership comes from Roblox and is checked on the server, so a cheater cannot give themselves the pass. The door alone is not a lock, because a cheater can move their character through walls; the VipArea guard moves non-owners out from the server (Step 4).
Type-checked with luau-lsp strict against Roblox's API definitions on 14 November 2026. Not playtested in Studio yet: press Play and watch the Output window before you publish.
Prompt for RoCode
Add a VIP game pass door to my game: a Script in ServerScriptService that checks UserOwnsGamePassAsync in a pcall with retries when players join and grants the pass from PromptGamePassPurchaseFinished, sets an OwnsVip attribute, puts owners' characters in a collision group that does not collide with parts tagged VipDoor, and every second moves non-owners inside parts tagged VipArea to a part tagged VipExit, plus a LocalScript that prompts the pass purchase when a non-owner touches the door and makes the door see-through for owners.
On this page
How a VIP door works
Every part has a CollisionGroup. Two groups can be set to pass through each other. So the door goes in a group called VipDoor, owners' characters go in a group called VipPlayers, and those two groups never collide. Everyone else's character stays in the default group and bumps into the door as normal.
| Piece | Runs on | Job |
|---|---|---|
| Ownership check | Server | UserOwnsGamePassAsync on join, PromptGamePassPurchaseFinished on purchase |
| Collision groups | Server | Owners' characters pass through the door, others do not |
| VIP room guard | Server | Moves non-owners who got inside back out |
| Buy prompt and see-through door | Client | Opens Roblox's purchase window on touch; looks only |
This is a focused version of the VIP perk in the game pass script guide, which also sells speed and tool passes from one script. If you already use that guide's GamePassHandler, use its VIP door instead of this one: two scripts putting characters in collision groups would fight.
Step 1: Create the pass and the door
- Publish your game, then open Creator Hub, go to Creations, pick the game, then Monetization and Passes. Create a pass named VIP with an image, set a price, and put it on sale.
- Copy the pass ID (the number in the pass's URL, or from its menu). The game pass guide shows where to find it.
- In Studio, add a Part that fills the VIP doorway. Tick Anchored and CanCollide, colour it gold and set Transparency to about 0.3 so it reads as a door.
- In the Properties window, scroll to Tags, click + and type
VipDoor. Tag every VIP door in your game the same way.
The room behind the door should be closed on every other side, including the roof, or players will simply jump in. Walls are normal parts; only the door is tagged.
Step 2: The server script
- Hover over ServerScriptService, click +, insert a Script named
VipDoorServer. - Paste the code below and put your pass ID in
VIP_PASS_ID.
-- Script in ServerScriptService named VipDoorServer.
-- Only VIP pass owners walk through parts tagged VipDoor. Non-owners inside VipArea parts are moved out.
local CollectionService = game:GetService("CollectionService")
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local VIP_PASS_ID = 0 -- your pass ID from Creator Hub
local TEST_AS_OWNER = false -- true = everyone counts as an owner, in Studio only
local GUARD_SECONDS = 1 -- how often non-owners are checked inside VipArea parts
local CHECK_ATTEMPTS = 3
local DOOR_GROUP = "VipDoor"
local OWNER_GROUP = "VipPlayers"
-- The two groups pass through each other; everything else collides as normal
for _, groupName in { DOOR_GROUP, OWNER_GROUP } do
if not workspace:IsCollisionGroupRegistered(groupName) then
workspace:RegisterCollisionGroup(groupName)
end
end
workspace:CollisionGroupSetCollidable(DOOR_GROUP, OWNER_GROUP, false)
local function setUpDoor(door: Instance)
if door:IsA("BasePart") then
door.CollisionGroup = DOOR_GROUP
-- The LocalScript reads this to open the right purchase window
door:SetAttribute("VipPassId", VIP_PASS_ID)
end
end
for _, door in CollectionService:GetTagged("VipDoor") do
setUpDoor(door)
end
CollectionService:GetInstanceAddedSignal("VipDoor"):Connect(setUpDoor)
local owners: { [Player]: boolean } = {}
local function putInGroup(character: Model)
for _, part in character:GetDescendants() do
if part:IsA("BasePart") then
part.CollisionGroup = OWNER_GROUP
end
end
end
local function grant(player: Player)
if owners[player] then
return
end
owners[player] = true
player:SetAttribute("OwnsVip", true)
if player.Character then
putInGroup(player.Character)
end
end
local function ownsPass(player: Player): boolean
if TEST_AS_OWNER and RunService:IsStudio() then
return true
end
if VIP_PASS_ID == 0 then
return false
end
for attempt = 1, CHECK_ATTEMPTS do
local ok, result = pcall(function()
return MarketplaceService:UserOwnsGamePassAsync(player.UserId, VIP_PASS_ID)
end)
if ok then
return result == true
end
warn("VIP check failed for " .. player.Name .. " (try " .. attempt .. "): " .. tostring(result))
task.wait(2 ^ attempt)
end
return false
end
local function onPlayerAdded(player: Player)
player:SetAttribute("OwnsVip", false)
-- New characters (and accessories that load late) join the owner group
player.CharacterAdded:Connect(function(character: Model)
if owners[player] then
putInGroup(character)
character.DescendantAdded:Connect(function(part: Instance)
if part:IsA("BasePart") then
part.CollisionGroup = OWNER_GROUP
end
end)
end
end)
if ownsPass(player) and player.Parent == Players then
grant(player)
end
end
Players.PlayerAdded:Connect(onPlayerAdded)
for _, player in Players:GetPlayers() do
task.spawn(onPlayerAdded, player)
end
Players.PlayerRemoving:Connect(function(player: Player)
owners[player] = nil
end)
-- Bought during this session: the server's event is the one to trust
MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player: Player, passId: number, wasPurchased: boolean)
if wasPurchased and passId == VIP_PASS_ID then
grant(player)
end
end)
-- The VIP room guard: non-owners inside a VipArea part are moved to the VipExit part
local function isInside(area: BasePart, position: Vector3): boolean
local offset = area.CFrame:PointToObjectSpace(position)
local half = area.Size / 2
return math.abs(offset.X) <= half.X and math.abs(offset.Y) <= half.Y and math.abs(offset.Z) <= half.Z
end
while true do
task.wait(GUARD_SECONDS)
local areas = CollectionService:GetTagged("VipArea")
local exit = CollectionService:GetTagged("VipExit")[1]
if #areas > 0 then
for _, player in Players:GetPlayers() do
local character = player.Character
local root = character and character:FindFirstChild("HumanoidRootPart")
if not owners[player] and character and root and root:IsA("BasePart") then
for _, area in areas do
if area:IsA("BasePart") and isInside(area, root.Position) then
if exit and exit:IsA("BasePart") then
character:PivotTo(exit.CFrame + Vector3.new(0, 3, 0))
else
-- No exit part: respawn them instead
task.spawn(function()
player:LoadCharacterAsync()
end)
end
break
end
end
end
end
end
end
What the script does
- Collision groups are registered once and set not to collide, the way Roblox's collisions page shows. Every tagged door joins
VipDoor, including doors added while the game runs. - ownsPass asks Roblox, retrying up to 3 times with a longer wait each time, because it is a web request and can fail. Roblox caches the answer, and its reference says a player who just bought the pass gets
truewhen they join a server. - grant remembers the owner, sets the
OwnsVipattribute that other scripts and the LocalScript read, and moves the current character intoVipPlayers. Every later character joins the group as it spawns. - PromptGamePassPurchaseFinished grants buyers at once, without rejoining. Roblox's reference says to listen to it only on the server, where
wasPurchasedis the final result. - The guard loop is Step 4.
Step 3: The buy prompt and see-through door
A door that silently blocks people sells nothing. This LocalScript opens Roblox's purchase window when a non-owner walks into a VIP door, at most once every few seconds, and makes the doors see-through on the owner's own screen so they can tell it is open to them.
- Open StarterPlayer, hover over StarterPlayerScripts, click + and insert a LocalScript named
VipDoorClient. - Paste the code below. It reads the pass ID from the door, so there is only one place to change it.
-- LocalScript in StarterPlayerScripts named VipDoorClient.
-- Prompts the VIP pass when a non-owner touches a VIP door, and fades the door for owners. Looks only.
local CollectionService = game:GetService("CollectionService")
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local PROMPT_COOLDOWN = 5 -- seconds between purchase windows
local OWNER_FADE = 0.6 -- extra transparency an owner sees on the door
local player = Players.LocalPlayer
local lastPrompt = 0
local function ownsVip(): boolean
return player:GetAttribute("OwnsVip") == true
end
local function updateLook(door: BasePart)
-- LocalTransparencyModifier only changes what this player sees
door.LocalTransparencyModifier = if ownsVip() then OWNER_FADE else 0
end
local function setUpDoor(door: Instance)
if not door:IsA("BasePart") then
return
end
updateLook(door)
door.Touched:Connect(function(hit: BasePart)
local character = player.Character
if not character or not hit:IsDescendantOf(character) or ownsVip() then
return
end
local passId = door:GetAttribute("VipPassId")
if type(passId) ~= "number" or passId == 0 then
return
end
local now = os.clock()
if now - lastPrompt < PROMPT_COOLDOWN then
return
end
lastPrompt = now
MarketplaceService:PromptGamePassPurchase(player, passId)
end)
end
for _, door in CollectionService:GetTagged("VipDoor") do
setUpDoor(door)
end
CollectionService:GetInstanceAddedSignal("VipDoor"):Connect(setUpDoor)
-- When the server grants the pass, fade every door at once
player:GetAttributeChangedSignal("OwnsVip"):Connect(function()
for _, door in CollectionService:GetTagged("VipDoor") do
if door:IsA("BasePart") then
updateLook(door)
end
end
end)
Nothing here grants anything. If an exploiter changes OwnsVip on their own device, the door fades on their screen but the server still has them in the default collision group, so it stays solid. Roblox's passes page shows the same split: prompt from a LocalScript, grant from a Script in ServerScriptService.
Step 4: Guard the VIP room
Each player's device moves their own character, so an exploiter can walk through the door, or any wall, whatever the collision groups say. If the VIP room only has a nicer view, you may not care. If it has a reward pad, a VIP-only shop or double coins, the server must also check who is standing in it.
- Add a Part that fills the whole VIP room, floor to ceiling. Name it
VipArea, tick Anchored, set Transparency to 1 and untick CanCollide, CanTouch and CanQuery. Tag itVipArea. - Add a small anchored, invisible, non-colliding part outside the door where non-owners should be put back. Tag it
VipExit.
The loop at the end of VipDoorServer checks every second. A non-owner whose root part is inside any VipArea box is moved to the VipExit part, or respawned if there is none. The box test is the same one the kill brick guide uses for rising lava: turn the position into the box's own coordinates and compare each axis with half its size.
Step 5: Test it
In Studio: the door
- Press Play with
TEST_AS_OWNERfalse. Walk into the door: it blocks you, and ifVIP_PASS_IDis set, the purchase window opens. - Stop, set
TEST_AS_OWNERtotrueand play again. The door looks faded and you walk straight through. - With TEST_AS_OWNER off again, test the guard: in the Explorer, select your character during Play and move it into the VIP room with the Move tool (on the Server view). Within a second you are put back at VipExit.
- Set
TEST_AS_OWNERback tofalse. It does nothing on live servers, but it keeps Studio honest.
In the published game: the purchase
- Put the real pass ID in VIP_PASS_ID, make sure the pass is on sale, and publish.
- Join from the Roblox app with an account that does not own the pass. Walk into the door, buy the pass, and walk through without rejoining.
- Leave and rejoin: the door should be open straight away.
Treat a purchase in the live game as real. Server warnings, such as a failed ownership check, show in the Developer Console (F9 in the Roblox app).
Common errors and fixes
Check the Output window first. Most VIP door problems are a tag, an ID or a second script.
Owners still cannot walk through
Check the door is tagged exactly VipDoor and that VIP_PASS_ID is the pass ID, not the game ID or an asset ID. If another script also sets characters' CollisionGroup (to stop players colliding, say), the last one wins: merge them into one script.
Everyone can walk through
The door is not CanCollide, or it is in the wrong group. Select it during Play on the Server view and check its CollisionGroup reads VipDoor.
The purchase window does not open
The LocalScript only prompts when the door has a non-zero VipPassId attribute, which the server sets from VIP_PASS_ID. It also waits 5 seconds between prompts. The pass must belong to this game and be on sale.
UserOwnsGamePassAsync failed
It is a web request and can fail now and then, which is why the script retries. If it always fails in Studio, publish the place first. The failure is warned in the Output with the reason.
Build it with RoCode
If you would rather not set this up by hand, RoCode can add a VIP room to the place you have open. RoCode is an independent AI agent for Roblox Studio, not made by Roblox: you describe the change in a web chat, and its Studio plugin creates the parts and scripts in your Explorer.
Add a VIP room behind a gold door that only owners of my VIP game pass can walk through, prompt the pass when someone bumps the door, and move anyone without the pass out of the room.
- Can read your place first to find the room and the walls around it
- Writes the scripts with Create Script and is told to compile-check each one with Check Script
- Sets an undo point before and after each batch of changes, so Ctrl+Z steps back one batch at a time
Creating the pass and setting its price happens in Creator Hub, which only you can do. How RoCode connects to Studio.
Questions
How do I make a VIP door in Roblox Studio?
Put the door in a collision group, check the pass with UserOwnsGamePassAsync on the server, and put owners' characters in a second group that does not collide with the door. Step 2 has the full script.
How do I make a game pass door that only owners can go through?
Use collision groups set from a server Script, so the door is solid for everyone except characters in the owners' group. Making the door non-collidable from a LocalScript only works on that one screen and is easy to copy.
Can exploiters get through a VIP door?
Yes, they can move their own character through any wall. Guard the room from the server (Step 4) and check ownership again in anything valuable inside.
How do I open the game pass purchase window when a player touches a door?
In a LocalScript, connect to the door's Touched event and call MarketplaceService:PromptGamePassPurchase(player, passId) with a cooldown. Step 3 has the script.
Why does my VIP door not open right after buying?
The join check only runs once. Listen to PromptGamePassPurchaseFinished on the server and grant the door when wasPurchased is true, as VipDoorServer does.
Sources and further reading
- Roblox Creator Docs: Passes. creating a pass, prompting and granting
- Roblox Creator Docs: MarketplaceService. UserOwnsGamePassAsync caching and PromptGamePassPurchaseFinished on the server
- Roblox Creator Docs: Collisions. collision groups for characters
- Roblox Creator Docs: Network ownership and movement validation. why the client controls its own character
How the code was checked: every script on this page passes Luau's strict type checker against Roblox's API definitions (luau-lsp, 14 November 2026). A type check catches misspelt APIs and wrong types, not game logic, so playtest in Studio before you publish.