local r=script.Parent local i=false local j=true local t=false local x=script.Parent.AccessDenied local E=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"]=true,["\091\083\067\080\093 \067\097\114\100-\076\052"]=true,["\091\083\067\080\093 \067\097\114\100-\076\051"]=true,["\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 i=1,r.Size.z/.3,1 do wait()r.CFrame=r.CFrame-r.CFrame.lookVector*.3 end end function closeDoor()script.Parent.DoorClose:play()for i=1,r.Size.z/.3,1 do wait()r.CFrame=r.CFrame+r.CFrame.lookVector*.3 end end script.Parent.Parent.KeycardReader1.touched:connect(function(r)if r.Name=="\072\097\110\100\108\101"and(H[r.Parent.Name]and j==true)then j=false E:Play()wait(.75)openDoor()wait(1)t=true elseif r.Name=="\072\097\110\100\108\101"and(H[r.Parent.Name]and t==true)then t=false E:Play()wait(.75)closeDoor()wait(1)j=true elseif r.Name=="\072\097\110\100\108\101"and(H[r.Parent.Name]==false and not i)then i=true x:Play()wait(2)i=false end end)script.Parent.Parent.KeycardReader2.touched:connect(function(r)if r.Name=="\072\097\110\100\108\101"and(H[r.Parent.Name]and j==true)then j=false E:Play()wait(.75)openDoor()wait(1)t=true elseif r.Name=="\072\097\110\100\108\101"and(H[r.Parent.Name]and t==true)then t=false E:Play()wait(.75)closeDoor()wait(1)j=true elseif r.Name=="\072\097\110\100\108\101"and(H[r.Parent.Name]==false and not i)then i=true x:Play()wait(2)i=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"] = true,
	["[SCP] Card-L4"] = true,
	["[SCP] Card-L3"] = true,
	["[SCP] Card-L2"] = false,
	["[SCP] Card-L1"] = false,
}

--DO NOT EDIT PAST THIS LINE--
function openDoor()
	script.Parent.DoorOpen:play()
	for i = 1, (door.Size.z / 0.30) do
		wait()
		door.CFrame = door.CFrame - (door.CFrame.lookVector * 0.30)
	end
end

function closeDoor()
	script.Parent.DoorClose:play()
	for i = 1, (door.Size.z / 0.30) do
		wait()
		door.CFrame = door.CFrame + (door.CFrame.lookVector * 0.30)
	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)
