local N=script.Parent local p=false local f=true local z=false local D=script.Parent.AccessDenied local y=script.Parent.AccessGranted local H={["\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}function openDoor()script.Parent.DoorOpen:play()for p=3,N.Size.z/.15,1 do wait()N.CFrame=N.CFrame-N.CFrame.lookVector*.15 end end function closeDoor()script.Parent.DoorClose:play()for p=3,N.Size.z/.15,1 do wait()N.CFrame=N.CFrame+N.CFrame.lookVector*.15 end end script.Parent.Parent.KeycardReader1.touched:connect(function(N)if N.Name=="\072\097\110\100\108\101"and(H[N.Parent.Name]and f==true)then f=false y:Play()wait(.75)openDoor()wait(1)z=true elseif N.Name=="\072\097\110\100\108\101"and(H[N.Parent.Name]and z==true)then z=false y:Play()wait(.75)closeDoor()wait(1)f=true elseif N.Name=="\072\097\110\100\108\101"and(H[N.Parent.Name]==false and not p)then p=true D:Play()wait(2)p=false end end)script.Parent.Parent.KeycardReader2.touched:connect(function(N)if N.Name=="\072\097\110\100\108\101"and(H[N.Parent.Name]and f==true)then f=false y:Play()wait(.75)openDoor()wait(1)z=true elseif N.Name=="\072\097\110\100\108\101"and(H[N.Parent.Name]and z==true)then z=false y:Play()wait(.75)closeDoor()wait(1)f=true elseif N.Name=="\072\097\110\100\108\101"and(H[N.Parent.Name]==false and not p)then p=true D:Play()wait(2)p=false end end)
--"False" = Not Acceptable Keycard To Open. "True" = Acceptable Keycard To Open.--

local door = script.Parent
local bool = false
local CanOpen1 = true
local CanClose1 = false
local AccessDenied = script.Parent.AccessDenied
local AccessGranted = script.Parent.AccessGranted
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 PAST THIS LINE--
function openDoor()
	script.Parent.DoorOpen:play()
	for i = 3, (door.Size.z / 0.15) do
		wait()
		door.CFrame = door.CFrame - (door.CFrame.lookVector * 0.15)
	end
end

function closeDoor()
	script.Parent.DoorClose:play()
	for i = 3, (door.Size.z / 0.15) do
		wait()
		door.CFrame = door.CFrame + (door.CFrame.lookVector * 0.15)
	end
end

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

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