User:Emess/Sandbox2

Introduction

VIP Doors are commonly used to restrict access to a certain area or areas of a map to a select few. There are two types of VIP Doors: those that determine whether or not to let a person through based on their username, and those that determine the same based on a person's shirt.

Building the door

  1. Open your place in Roblox Studio. Make a cool room with something awesome in it that you don't want everyone to have.
  2. Select the brick (not several bricks, or a group of bricks, or a model, but a single brick) that you want to be the VIP door. You will need to stretch a brick to make it the size you need to fit a humanoid through a brick. Then, click Insert and select Object. Find the Script object in the menu that appears, and select it.
  3. Double click on the script in the Explorer tab (on the right) to open it. Copy the script at the bottom of this page into it.
  4. Change the names in the permission section to those of the people you want to let through the door. NOTE: If you test the VIP doors in Roblox Studio by selecting play solo they will not work as your name becomes 'player'.

Getting the shirt's asset

Go open up Roblox Studio, add a baseplate, and test the game (Tools > Test > Play Solo). Put this script in the command bar:

print(game.Workspace.Player.Shirt.ShirtTemplate)

Make sure the Output window is open, and copy and paste that asset link into the shirt variable at the top of the scripts listed below.

Getting the t-shirt's asset

Go open up Roblox Studio, add a baseplate, and test the game (Tools > Test > Play Solo). Put this script in the command bar:

print(game.Workspace.Player.ShirtGraphic.Graphic)

Make sure the Output window is open, and copy and paste that asset link into the shirt variable at the top of the scripts listed below.

VIP door scripts

Personal door

local user = "Player" -- change this to the name of the person the personal door belongs to
local parent_transparency = script.Parent.Transparency 

function onTouched(hit)
	local humanoid = hit.Parent:FindFirstChild("Humanoid")
	if humanoid ~= nil then
		if string.lower(hit.Parent.Name) == string.lower(user) then
			script.Parent.CanCollide = false
			script.Parent.Transparency = 0.4
			wait(4) -- You can change the number to the amount of seconds you want the door to be open
			script.Parent.CanCollide = true
			script.Parent.Transparency = parent_transparency
		else
			hit.Parent:BreakJoints() -- remove this line if you want a non-killing door
		end
	end
end

script.Parent.Touched:connect(onTouched)

Personal + T-Shirt door

local user = "Player" -- change this to the name of the person the personal door belongs to
local shirt = "ASSET ID HERE" -- change this to the t-shirt's asset ID

local parent_transparency = script.Parent.Transparency

function onTouched(hit)
	local humanoid = hit.Parent:FindFirstChild("Humanoid")
	if humanoid ~= nil then
		if string.lower(hit.Parent.Name) == string.lower(user) or
		   hit.Parent.ShirtGraphic.Graphic == shirt then
			script.Parent.CanCollide = false
			script.Parent.Transparency = 0.4
			wait(4) -- You can change the number to the amount of seconds you want the door to be open
	

===Personal + Shirt door===
<pre>local user = "Player" -- change this to the name of the person the personal door belongs to
local shirt = "ASSET ID HERE" -- change this to the shirt's asset ID

local parent_transparency = script.Parent.Transparency

function onTouched(hit)
	local humanoid = hit.Parent:FindFirstChild("Humanoid")
	if humanoid ~= nil then
		if string.lower(hit.Parent.Name) == string.lower(user) or
		   hit.Parent.Shirt.ShirtTemplate == shirt then
			script.Parent.CanCollide = false
			script.Parent.Transparency = 0.4
			wait(4) -- You can change the number to the amount of seconds you want the door to be open
			script.Parent.CanCollide = true
			script.Parent.Transparency = parent_transparency
		else
			hit.Parent:BreakJoints() -- remove this line if you want a non-killing door
		end
	end
end

Personal + Clan door

local user = "Player" -- change this to the name of the person the personal door belongs to
local clanId = 7 -- change this to your clan's ID (7 is the official Roblox fan club)

local parent_transparency = script.Parent.Transparency

function onTouched(hit)
	local humanoid = hit.Parent:FindFirstChild("Humanoid")
	if humanoid ~= nil then
		local player = game.Players:PlayerFromCharacter(hit.Parent)
		if string.lower(hit.Parent.Name) == string.lower(user) or player:IsInGroup(clanId) then
			script.Parent.CanCollide = false
			script.Parent.Transparency = 0.4
			wait(4) -- You can change the number to the amount of seconds you want the door to be open
			script.Parent.CanCollide = true
			script.Parent.Transparency = parent_transparency
		else
			hit.Parent:BreakJoints() -- remove this line if you want a non-killing door
		end
	end
end