--[[
game.ServerScriptService.Server.AirlocksRemoteControl.Event:Connect(function(command)
	
	if command == "lock" then
		Debounce = true
		script.Parent.LockShowA.BrickColor = BrickColor.new("Bright red")
		script.Parent.LockShow2A.BrickColor = BrickColor.new("Bright red")
		script.Parent.LockShowC.BrickColor = BrickColor.new("Bright red")
		script.Parent.LockShowB.BrickColor = BrickColor.new("Bright red")
		script.Parent.LockShow2B.BrickColor = BrickColor.new("Bright red")
		CloseAll()
	elseif command == "unlock" then
		script.Parent.LockShowA.BrickColor = BrickColor.new("Bright green")
		script.Parent.LockShow2A.BrickColor = BrickColor.new("Bright green")
		script.Parent.LockShowC.BrickColor = BrickColor.new("Bright green")
		script.Parent.LockShowB.BrickColor = BrickColor.new("Bright green")
		script.Parent.LockShow2B.BrickColor = BrickColor.new("Bright green")
		Debounce = false
	elseif command == "eopen" then
		Debounce = true
		script.Parent.LockShowA.BrickColor = BrickColor.new("Deep orange")
		script.Parent.LockShow2A.BrickColor = BrickColor.new("Deep orange")
		script.Parent.LockShowC.BrickColor = BrickColor.new("Deep orange")
		script.Parent.LockShowB.BrickColor = BrickColor.new("Deep orange")
		script.Parent.LockShow2B.BrickColor = BrickColor.new("Deep orange")
		OpenAll()
	end
	
end)
]]
--

script.Parent.ButtonA.ClickDetector.MouseClick:Connect(function()
	if DoorStatusA == "Closed" and DoorStatusB == "Closed" and Main == "N/A" and Debounce == false then
		Debounce = true
		OpenDoor1()
		Debounce = false
		Main = "Door2"
	elseif DoorStatusA == "Opened" and DoorStatusB == "Closed" and Main == "Door2" and Debounce == false then
		Debounce = true
		CloseDoor1()
		Cycle()
		OpenDoor2()
		Main = "Door1"
		Debounce=false
	elseif DoorStatusA == "Closed" and DoorStatusB == "Opened" and Main == "Door1" and Debounce == false then
		Debounce = true
		CloseDoor2()
		Cycle()
		OpenDoor1()
		Main = "Door2"
		Debounce=false
	end
end)

script.Parent.Button2A.ClickDetector.MouseClick:Connect(function()
	if DoorStatusA == "Closed" and DoorStatusB == "Closed" and Main == "N/A" and Debounce == false then
		print("how did you even get in there lol")
		Debounce = true
		OpenDoor1()
		Debounce = false
		Main = "Door2"
	elseif DoorStatusA == "Opened" and DoorStatusB == "Closed" and Main == "Door2" and Debounce == false then
		Debounce = true
		CloseDoor1()
		Cycle()
		OpenDoor2()
		Main = "Door1"
		Debounce=false
	elseif DoorStatusA == "Closed" and DoorStatusB == "Opened" and Main == "Door1" and Debounce == false then
		Debounce = true
		CloseDoor2()
		Cycle()
		OpenDoor1()
		Main = "Door2"
		Debounce=false
	end
end)

script.Parent.ButtonB.ClickDetector.MouseClick:Connect(function()
	if DoorStatusA == "Closed" and DoorStatusB == "Closed" and Main == "N/A" and Debounce == false then
		Debounce = true
		OpenDoor2()
		Debounce = false
		Main = "Door1"
	elseif DoorStatusA == "Closed" and DoorStatusB == "Opened" and Main == "Door1" and Debounce == false then
		Debounce = true
		CloseDoor2()
		Cycle()
		OpenDoor1()
		Main = "Door2"
		Debounce=false
	elseif DoorStatusA == "Opened" and DoorStatusB == "Closed" and Main == "Door2" and Debounce == false then
		Debounce = true
		CloseDoor1()
		Cycle()
		OpenDoor2()
		Main = "Door1"
		Debounce=false
	end
end)

script.Parent.Button2B.ClickDetector.MouseClick:Connect(function()
	if DoorStatusA == "Closed" and DoorStatusB == "Closed" and Main == "N/A" and Debounce == false then
		Debounce = true
		OpenDoor2()
		Debounce = false
		Main = "Door1"
	elseif DoorStatusA == "Closed" and DoorStatusB == "Opened" and Main == "Door1" and Debounce == false then
		Debounce = true
		CloseDoor2()
		Cycle()
		OpenDoor1()
		Main = "Door2"
		Debounce=false
	elseif DoorStatusA == "Opened" and DoorStatusB == "Closed" and Main == "Door2" and Debounce == false then
		Debounce = true
		CloseDoor1()
		Cycle()
		OpenDoor2()
		Main = "Door1"
		Debounce=false
	end
end)

script.Parent.ButtonC.ClickDetector.MouseClick:Connect(function()
	if DoorStatusA == "Closed" and DoorStatusB == "Closed" and Main == "N/A" and Debounce == false then
		Debounce = true
		OpenDoor2()
		Debounce = false
		Main = "Door1"
	elseif DoorStatusA == "Closed" and DoorStatusB == "Opened" and Main == "Door1" and Debounce == false then
		Debounce = true
		CloseDoor2()
		Cycle()
		OpenDoor1()
		Main = "Door2"
		Debounce=false
	elseif DoorStatusA == "Opened" and DoorStatusB == "Closed" and Main == "Door2" and Debounce == false then
		Debounce = true
		CloseDoor1()
		Cycle()
		OpenDoor2()
		Main = "Door1"
		Debounce=false
	end
end)
