Lift issues

task autonomous() // right side autonomous is in place right now
{
resetMotorEncoder(clamp1);
resetMotorEncoder(clamp2);
SensorValue[rightencoder] = 0;
SensorValue[leftencoder] = 0;

if(SensorValue[potent] < 1200)
{
motor[lift1] = -127;
motor[lift2] = -127;
}
else if(SensorValue[potent] > 1200)
{
motor[lift1] = 0;
motor[lift2] = 0;
}
if(SensorValue[rightencoder] > -1000)
{
motor[motor1] = 63;
motor[motor2] = 63;
motor[motor3] = 63;
motor[motor4] = 63;
}
else if(SensorValue[rightencoder] < -1000)
{
motor[motor1] = 0;
motor[motor2] = 0;
motor[motor3] = 0;
motor[motor4] = 0;
motor[clamp1] = 63;
motor[clamp2] = 63;
}

Using the above code our lift is supposed to stop when the potentiometer reaches a value greater than 1200, yet it does not and instead the lift just raises all the way up. Why?

Check that the potentiometer is increasing in value when the lift is being raised. You also need to place the test inside a while loop otherwise your "if statements will only be evaluated once.

task autonomous()
{
  resetMotorEncoder(clamp1);
  resetMotorEncoder(clamp2);
  SensorValue[rightencoder] = 0;
  SensorValue[leftencoder] = 0;

  while( true ) {
    if(SensorValue[potent] < 1200)
    {
      motor[lift1] = -127;
      motor[lift2] = -127;
    }
    else if(SensorValue[potent] > 1200)
    {
      motor[lift1] = 0;
      motor[lift2] = 0;
    }
    if(SensorValue[rightencoder] > -1000)
    {
      motor[motor1] = 63;
      motor[motor2] = 63;
      motor[motor3] = 63;
      motor[motor4] = 63;
    }
    else if(SensorValue[rightencoder] < -1000)
    {
      motor[motor1] = 0;
      motor[motor2] = 0;
      motor[motor3] = 0;
      motor[motor4] = 0;
      motor[clamp1] = 63;
      motor[clamp2] = 63;
    }
    
    wait1Msec(20);
  }
}