local x=true local e=true local P={["\091\083\067\080\093 \067\097\114\100-\079\109\110\105"]=true;["\091\083\067\080\093 \067\097\114\100-\076\053"]=false;["\091\083\067\080\093 \067\097\114\100-\076\052"]=false,["\091\083\067\080\093 \067\097\114\100-\076\051"]=false,["\091\083\067\080\093 \067\097\114\100-\076\050"]=false;["\091\083\067\080\093 \067\097\114\100-\076\049"]=false}local S=script.Parent local j=script.Parent.Parent.RightDoor local s=false local z=script.Parent.DoorOpen local r=script.Parent.DoorClose local n=false function openDoor()if not n then n=true if s then s=false r:Play()Spawn(function()for x=1,60,1 do S.CFrame=S.CFrame+S.CFrame.lookVector*.1 wait(.05)end end)Spawn(function()for x=1,60,1 do j.CFrame=j.CFrame+j.CFrame.lookVector*.1 wait(.05)end end)else s=true z:Play()Spawn(function()for x=1,60,1 do S.CFrame=S.CFrame-S.CFrame.lookVector*.1 wait(.05)end end)Spawn(function()for x=1,60,1 do j.CFrame=j.CFrame-j.CFrame.lookVector*.1 wait(.05)end end)end wait(2.5)n=false end end script.Parent.Parent.KeycardReader1.touched:connect(function(S)if S.Name=="\072\097\110\100\108\101"and(P[S.Parent.Name]and x)then x=false script.Parent.AccessGranted:play()wait(.75)openDoor()wait(3)x=true elseif S.Name=="\072\097\110\100\108\101"and(not P[S.Parent.Name]and e)then e=false script.Parent.AccessDenied:play()wait(1)e=true end end)script.Parent.Parent.KeycardReader2.touched:connect(function(S)if S.Name=="\072\097\110\100\108\101"and(P[S.Parent.Name]and x)then x=false script.Parent.AccessGranted:play()wait(.75)openDoor()wait(3)x=true elseif S.Name=="\072\097\110\100\108\101"and(not P[S.Parent.Name]and e)then e=false script.Parent.AccessDenied:play()wait(1)e=true end end)
--"False" = Not Acceptable Keycard To Open. "True" = Acceptable Keycard To Open.--

local bool = true
local bool2 = true
local clearance = {
	["[SCP] Card-Omni"] = true,
	["[SCP] Card-L5"] = false,
	["[SCP] Card-L4"] = false,
	["[SCP] Card-L3"] = false,
	["[SCP] Card-L2"] = false,
	["[SCP] Card-L1"] = false,
}

--DO NOT EDIT BEYOND THIS LINE--
local LeftDoor = script.Parent
local RightDoor = script.Parent.Parent.RightDoor
local Open = false

local OpenSound = script.Parent.DoorOpen
local CloseSound = script.Parent.DoorClose

local Debounce = false
function openDoor()
	if not Debounce then
		Debounce = true
		if Open then
			Open = false
			CloseSound:Play()
			Spawn(function()
				for i = 1, 60 do
					LeftDoor.CFrame = LeftDoor.CFrame + (LeftDoor.CFrame.lookVector * 0.1)
					wait(0.05)
				end
			end)
			Spawn(function()
				for i = 1, 60 do
					RightDoor.CFrame = RightDoor.CFrame + (RightDoor.CFrame.lookVector * 0.1)
					wait(0.05)
				end
			end)
		else
			Open = true
			OpenSound:Play()
			Spawn(function()
				for i = 1, 60 do
					LeftDoor.CFrame = LeftDoor.CFrame - (LeftDoor.CFrame.lookVector * 0.1)
					wait(0.05)
				end
			end)
			Spawn(function()
				for i = 1, 60 do
					RightDoor.CFrame = RightDoor.CFrame - (RightDoor.CFrame.lookVector * 0.1)
					wait(0.05)
				end
			end)
		end
		wait(2.5)
		Debounce = false
	end
end

script.Parent.Parent.KeycardReader1.touched:connect(function(touch)
	if touch.Name == "Handle" and clearance[touch.Parent.Name] and bool then
		bool = false
		script.Parent.AccessGranted:play()
		wait(0.75)
		openDoor()
		wait(3)
		bool = true
	elseif touch.Name == "Handle" and not clearance[touch.Parent.Name] and bool2 then
		bool2 = false
		script.Parent.AccessDenied:play()
		wait(1)
		bool2 = true
	end
end)

script.Parent.Parent.KeycardReader2.touched:connect(function(touch)
	if touch.Name == "Handle" and clearance[touch.Parent.Name] and bool then
		bool = false
		script.Parent.AccessGranted:play()
		wait(0.75)
		openDoor()
		wait(3)
		bool = true
	elseif touch.Name == "Handle" and not clearance[touch.Parent.Name] and bool2 then
		bool2 = false
		script.Parent.AccessDenied:play()
		wait(1)
		bool2 = true
	end
end)
