Hi, @jamier07
Welcome to the forum.
Please read the post at the start of any forum , entitled "How to use this Forum".
Your code shows;
digitalWrite (LED2, HIGH);
digitalWrite (LED1, LOW);
but no
digitalWrite (LED2, LOW);
digitalWrite (LED1, HIGH;
redledPin and greenledPin would be better descriptions of the pins rather than LED1 and LED2.
exitPin would also be good, so you know the different purposes of the variables.
Tom...
PS, Do a CTRL-T in the IDE, it will format your code with indents to make your code easy to read.