Escape Room Key Switches

So I have five keyswitches (two pin), and I want them to be turned in a specific order, sort of like a key pad. If one is turned incorrectly, I want a red led to turn on and the program to stop. If they are tuned in the right order, a green LED turns on. However, none of this is working. I have the key switches wired up to a pin and then to ground, and I still can’t get it to work. I dont know what to do.

Code:

while (two == true)
	{
		// see if all of the wires are connected
		if (digitalRead(32) == LOW)
		{

			// turn on the green LED
			digitalWrite(gled1Pin, HIGH);
			Serial.println("Blue Wire Cut");

			// see if rest of wires are connected
			if (digitalRead(33) == LOW)
			{
			  
				// turn on second green LED
				digitalWrite(gled2Pin, HIGH);
        Serial.println("Orange Wire Cut");
        
				if (digitalRead(34) == LOW)
				{

					// turn third LED on
					digitalWrite(gled3Pin, HIGH);
					Serial.println("Green Wire Cut");

					// see if rest of wires are connected
          if (digitalRead(35) == LOW)
					{

						// turn on fourth LED
						digitalWrite(gled4Pin, HIGH);
            Serial.println("White Wire Cut");
            
						// see if the rest of the wires are connected
						if (digitalRead(36) == LOW)
						{

							// turn on last green LED
							digitalWrite(gled5Pin, HIGH);
              Serial.println("Yellow Wire Cut");
							// pause three seconds
							delay(3000);

							// turn off green LEDs
							digitalWrite(bled1Pin, LOW);
							digitalWrite(bled2Pin, HIGH);
							digitalWrite(gled1Pin, LOW);
							digitalWrite(gled2Pin, LOW);
							digitalWrite(gled3Pin, LOW);
							digitalWrite(gled4Pin, LOW);
							digitalWrite(gled5Pin, LOW);
							two = true;
							one = false;
						}
						else
						{
							
						}
					}
					else if (!digitalRead(35) == LOW  && !digitalRead(36) == LOW)
					{
					  
					  Serial.println("wrong key");
					  
					}
					else
					{
						// set the fail stage to true
						fail = true;
						one = false;
					}
				}
				else if (!digitalRead(34) == LOW && !digitalRead(35) == LOW  && !digitalRead(36) == LOW)
				{
				  
				  Serial.println("wrong key");
				  
				}
				else
				{
					fail = true;
					one = false;
				}
			}
			else if (!digitalRead(33) == LOW  && !digitalRead(34) == LOW  && !digitalRead(35) == LOW  && !digitalRead(36) == LOW)
			{
			  
			  Serial.println("wrong key");
			  
			}
			else
			{
				fail = true;
				one = false;
			}
		}
		else if (!digitalRead(32) == LOW  && !digitalRead(33) == LOW  && !digitalRead(34) == LOW  && !digitalRead(35) == LOW  && !digitalRead(36) == LOW)
		{
		  
		  Serial.println("wrong key");
		   
		}
		else
		{
			fail = true;
			one = false;
		}
	}

Please post your sketch here.

I have the key switches wired up to a pin and then to ground

What pinMode() did you use for the input pins ? Have you got pullup resistors on them to keep them in a known state at all times ?

I see a while (two == true) and somewhere a line two = false. No break statement either.
That means two never gets set to false, and this loop will never exit.

For help you have to do these three things.

  1. post the complete sketch (strip out everything not related to these buttons but make it a complete sketch - just to handle these buttons).
  2. write down a complete, detailed flow chart of what you want the system to do exactly, based on button presses: how to react to correct presses, incorrect presses, what to do when an incorrect press is detected (I suppose you will want a way to go back to retry) and what to do when all correct presses have been detected.
  3. provide a circuit diagram of how exactly those buttons are wired.