hi im trying to make a door that opens when you use a trigger_use

it works just fine but the button only opens it once?

i want the door to open and close after 4 secs

then after 10 seconds you can push button again to open door again

can someone help? thanks

Code:
button = getEnt("button", "targetname");
	door = getEnt("door", "targetname");
    button waittill("trigger", player);
	
    angle = 90; // 4 times = one full round
    seconds = 1;
        
    {	
        for (i=0; i<1; i++)
        {            
            door rotateYaw(angle, seconds);
			door waittill("rotatedone");
			wait 4;
			angle = -90;
			seconds = 1;
			door rotateYaw(angle, seconds);
			door waittill("rotatedone");
			wait 0.5;
        }
        }