how do I write code so robot will wait for button push before line following?

robot follows line very well until I add button to start program, then it only moves forward…I am stumped! Goal is for robot to follow line after button push.

#pragma config(Sensor, in1, lineFollowerRIGHT, sensorLineFollower)
#pragma config(Sensor, in2, lineFollowerCENTER, sensorLineFollower)
#pragma config(Sensor, in3, lineFollowerLEFT, sensorLineFollower)
#pragma config(Sensor, dgtl1, button, sensorTouch)
#pragma config(Motor, port2, rightMotor, tmotorServoContinuousRotation, openLoop)
#pragma config(Motor, port3, leftMotor, tmotorServoContinuousRotation, openLoop)
//!!Code automatically generated by ‘ROBOTC’ configuration wizard !!//

task main()
{

while(true)
{

if(SensorValue(button)==1)
{
wait(1);
}

if(SensorValue(lineFollowerRIGHT) > threshold)
{
 
  motor[leftMotor]  = 30;
  motor[rightMotor] = -45;
}

if(SensorValue(lineFollowerCENTER) > threshold)
{
 
  motor[leftMotor]  = 30;
  motor[rightMotor] = 30;
}

if(SensorValue(lineFollowerLEFT) > threshold)
{
 
  motor[leftMotor]  = -45;
  motor[rightMotor] = 30;

}
}
}

You should probably move the button before the while loop and also change so it will block until the button is pressed. As you have configured the button as sensorTouch it will return 1 when pressed. Something like this.

task main()
{
  // wait for button press
  while(SensorValue(button) == 0) {
    wait(5);
  }
  // SensorValue(button) is now 1 so move on

  // do the line following
  while(true)
    {
    if(SensorValue(lineFollowerRIGHT) > threshold)
      {
      motor[leftMotor] = 30;
      motor[rightMotor] = -45;
      }
      
  etc......