240sx:
so to get my code to work i need to do major changes to get the button to remember the sate for the lights for a set time? & executing the loop. also by getting rid of a delay i can use "millis" is millis a built in timer ?
You already have a basic idea of what you want, maybe the hardest part even if you change how it is to work. The more specific you are about that, the easier it will be to code. Honest, changing the spec while coding has led to umpteen missed deadlines.
Nick Gammon on this forum has a page where he compares coding to making egg and toast for breakfast. The top-down way, first you cook the egg for X minutes and then you cook the toast for Y minutes and then you are done. IRL you start the egg and take note of the time then start the toast and take note of that time. When X minutes have gone by, the egg is done. When Y minutes have gone by, the toast is done. It doesn't matter of X is more than Y since you watch the time rather than depend on the egg or toast being done first. Every second you are only watching for something to be done.
You can use loop() that way (don't have to). Every time through loop() what code is run depends on conditions you have saved as 'states'. Your code is always "in the now". So in your case you can get by just saving what color light is lit and when it started. If the color is green then you want to watch for 5 seconds to have gone by before turning green off, switching yellow on and changing the color state from green to yellow.
During that 5 seconds loop() will run many millions of times, letting your code watch for button press. If the button is pressed it doesn't matter what color light is lit, you change the light and the color state then that becomes "the now" for the next time through loop(). You can even have extra "color states" that have different timing, like flashing yellow or red or an Officer in charge mode that only changes with a button press, though how you get into such a mode is up to you. Once you have the basic code it is not a big deal to add such modes.
The important thing is to change from the fixed sequence (first green, the yellow, then red) inside of loop() to controlling what code runs during each pass through loop() using stored conditions/states and whatever happens, like a button press. It will liberate you from having to integrate exceptions and time-watching and any new ideas into the same structure that controls the fixed step 1 then step 2 then step 3 sequence.