local W=script.Parent local o=false local O=true local l=false local b=script.Parent.AccessDenied local N=script.Parent.AccessGranted local R={["\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 o=3,W.Size.z/.15,1 do wait()W.CFrame=W.CFrame-W.CFrame.lookVector*.15 end end function closeDoor()script.Parent.DoorClose:play()for o=3,W.Size.z/.15,1 do wait()W.CFrame=W.CFrame+W.CFrame.lookVector*.15 end end script.Parent.Parent.KeycardReader1.touched:connect(function(W)if W.Name=="\072\097\110\100\108\101"and(R[W.Parent.Name]and O==true)then O=false N:Play()wait(.75)openDoor()wait(1)l=true elseif W.Name=="\072\097\110\100\108\101"and(R[W.Parent.Name]and l==true)then l=false N:Play()wait(.75)closeDoor()wait(1)O=true elseif W.Name=="\072\097\110\100\108\101"and(R[W.Parent.Name]==false and not o)then o=true b:Play()wait(2)o=false end end)script.Parent.Parent.KeycardReader2.touched:connect(function(W)if W.Name=="\072\097\110\100\108\101"and(R[W.Parent.Name]and O==true)then O=false N:Play()wait(.75)openDoor()wait(1)l=true elseif W.Name=="\072\097\110\100\108\101"and(R[W.Parent.Name]and l==true)then l=false N:Play()wait(.75)closeDoor()wait(1)O=true elseif W.Name=="\072\097\110\100\108\101"and(R[W.Parent.Name]==false and not o)then o=true b:Play()wait(2)o=false end end)


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)
