How do you make a push button work as a toggle switch using PLTW natural language?

Here the currant code is:

#pragma config(Sensor, dgtl1,  StartButton,    sensorTouch)
#pragma config(Sensor, dgtl2,  SonarF,         sensorSONAR_inch)
#pragma config(Sensor, dgtl4,  StopButton,     sensorTouch)
#pragma config(Sensor, dgtl7,  SonarB,         sensorSONAR_cm)
#pragma config(Sensor, dgtl9,  SonarR,         sensorSONAR_cm)
#pragma config(Sensor, dgtl11, SonarL,         sensorSONAR_cm)
#pragma config(Motor,  port2,           MotorRF,       tmotorNone, openLoop)
#pragma config(Motor,  port3,           MotorRM,       tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor,  port4,           MotorRB,       tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor,  port5,           MotorLF,       tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port6,           MotorLM,       tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port7,           MotorLB,       tmotorNone, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

//Project Title: Paoli IN, LRCC Sumobot MK2
//  Team Members: Joshua N Barnett, Xander Phelps
//  Date: 03/04/2020
//  Section: RDI

//Psudocode:

//		button switch pressed
//		scan with front sonar by revolving right
//			(right motors going backwards, and left motors going fowards)
//		once object detected
//			procede towards object at half speed
//		once object within 2 inches
//			procede foward at top speed

task main()
{
    int enable = false, btnState = false;
    while(1)
    {
        enable = SensorValue[StartButton] && !btnState ? !enable : enable;
        btnState = SensorValue[StartButton];

        if(enable)
        {
            wait(5);
            if(SensorValue(SonarF) < 2)/*Determine which Sonar*/
            {
                startMotor(MotorRF, 100);
                startMotor(MotorRM, 100);
                startMotor(MotorRB, 100);
                startMotor(MotorLF, 100);
                startMotor(MotorLM, 100);
                startMotor(MotorLB, 100);
            }
            else if(SensorValue(SonarF) < 20)/*Determine which Sonar*/
            {
                startMotor(MotorRF, 50);
                startMotor(MotorRM, 50);
                startMotor(MotorRB, 50);
                startMotor(MotorLF, 50);
                startMotor(MotorLM, 50);
                startMotor(MotorLB, 50);
            }
            else
            {
                startMotor(MotorRF, -50);
                startMotor(MotorRM, -50);
                startMotor(MotorRB, -50);
                startMotor(MotorLF, 50);
                startMotor(MotorLM, 50);
                startMotor(MotorLB, 50);
            }
        }
        else
        {
            stopMotor(MotorRF);
            stopMotor(MotorRM);
            stopMotor(MotorRB);
            stopMotor(MotorLF);
            stopMotor(MotorLM);
            stopMotor(MotorLB);
        }
        wait1Msec(10);
    }
}

when I try to copy and paste and switch the sonar it won’t even start.

#pragma config(Sensor, dgtl1,  StartButton,    sensorTouch)
#pragma config(Sensor, dgtl2,  SonarF,         sensorSONAR_inch)
#pragma config(Sensor, dgtl4,  StopButton,     sensorTouch)
#pragma config(Sensor, dgtl7,  SonarB,         sensorSONAR_cm)
#pragma config(Sensor, dgtl9,  SonarR,         sensorSONAR_cm)
#pragma config(Sensor, dgtl11, SonarL,         sensorSONAR_cm)
#pragma config(Motor,  port2,           MotorRF,       tmotorNone, openLoop)
#pragma config(Motor,  port3,           MotorRM,       tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor,  port4,           MotorRB,       tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor,  port5,           MotorLF,       tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port6,           MotorLM,       tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port7,           MotorLB,       tmotorNone, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

//Project Title: Paoli IN, LRCC Sumobot MK2
//  Team Members: Joshua N Barnett, Xander Phelps
//  Date: 03/04/2020
//  Section: RDI

//Psudocode:

//		button switch pressed
//		scan with front sonar by revolving right
//			(right motors going backwards, and left motors going fowards)
//		once object detected
//			procede towards object at half speed
//		once object within 2 inches
//			procede foward at top speed

task main()
{
    int enable = false, btnState = false;
    while(1)
    {
        enable = SensorValue[StartButton] && !btnState ? !enable : enable;
        btnState = SensorValue[StartButton];

        if(enable)
        {
            wait(5);
            if(SensorValue(SonarF) < 2)/*Determine which Sonar*/
            {
                startMotor(MotorRF, 100);
                startMotor(MotorRM, 100);
                startMotor(MotorRB, 100);
                startMotor(MotorLF, 100);
                startMotor(MotorLM, 100);
                startMotor(MotorLB, 100);
            }
            else if(SensorValue(SonarF) < 20)/*Determine which Sonar*/
            {
                startMotor(MotorRF, 50);
                startMotor(MotorRM, 50);
                startMotor(MotorRB, 50);
                startMotor(MotorLF, 50);
                startMotor(MotorLM, 50);
                startMotor(MotorLB, 50);
            }
            else
            {if(SensorValue(SonarR) < 2)/*Determine which Sonar*/
            {
                startMotor(MotorRF, -50);
                startMotor(MotorRM, -50);
                startMotor(MotorRB, -50);
                startMotor(MotorLF, 50);
                startMotor(MotorLM, 50);
                startMotor(MotorLB, 50);
            }
            else if(SensorValue(SonarR) < 20)/*Determine which Sonar*/
            {
                startMotor(MotorRF, -50);
                startMotor(MotorRM, -50);
                startMotor(MotorRB, -50);
                startMotor(MotorLF, 50);
                startMotor(MotorLM, 50);
                startMotor(MotorLB, 50);
            }
            else
            {if(SensorValue(SonarB) < 2)/*Determine which Sonar*/
            {
                startMotor(MotorRF, -50);
                startMotor(MotorRM, -50);
                startMotor(MotorRB, -50);
                startMotor(MotorLF, -50);
                startMotor(MotorLM, -50);
                startMotor(MotorLB, -50);
            }
            else if(SensorValue(SonarR) < 20)/*Determine which Sonar*/
            {
                startMotor(MotorRF, -50);
                startMotor(MotorRM, -50);
                startMotor(MotorRB, -50);
                startMotor(MotorLF, -50);
                startMotor(MotorLM, -50);
                startMotor(MotorLB, -50);
            }
            else
            	 {if(SensorValue(SonarL) < 2)/*Determine which Sonar*/
            {
                startMotor(MotorRF, 50);
                startMotor(MotorRM, 50);
                startMotor(MotorRB, 50);
                startMotor(MotorLF, -50);
                startMotor(MotorLM, -50);
                startMotor(MotorLB, -50);
            }
            else if(SensorValue(SonarL) < 20)/*Determine which Sonar*/
            {
                startMotor(MotorRF, 50);
                startMotor(MotorRM, 50);
                startMotor(MotorRB, 50);
                startMotor(MotorLF, -50);
                startMotor(MotorLM, -50);
                startMotor(MotorLB, -50);
            }
            else
            {
                startMotor(MotorRF, -50);
                startMotor(MotorRM, -50);
                startMotor(MotorRB, -50);
                startMotor(MotorLF, 50);
                startMotor(MotorLM, 50);
                startMotor(MotorLB, 50);
            }
        }
        
        }
        wait1Msec(10);
    }
}}}

I Think It works now.

#pragma config(Sensor, dgtl1,  StartButton,    sensorTouch)
#pragma config(Sensor, dgtl2,  SonarF,         sensorSONAR_inch)
#pragma config(Sensor, dgtl4,  StopButton,     sensorTouch)
#pragma config(Sensor, dgtl7,  SonarB,         sensorSONAR_cm)
#pragma config(Sensor, dgtl9,  SonarR,         sensorSONAR_cm)
#pragma config(Sensor, dgtl11, SonarL,         sensorSONAR_cm)
#pragma config(Motor,  port2,           MotorRF,       tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port3,           MotorRM,       tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port4,           MotorRB,       tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port5,           MotorLF,       tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor,  port6,           MotorLM,       tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port7,           MotorLB,       tmotorNone, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

//Project Title: Paoli IN, LRCC Sumobot MK2
//  Team Members: Joshua N Barnett, Xander Phelps
//  Date: 03/04/2020
//  Section: RDI

//Psudocode:

//		button switch pressed
//		scan with front sonar by revolving right
//			(right motors going backwards, and left motors going fowards)
//		once object detected
//			procede towards object at half speed
//		once object within 2 inches
//			procede foward at top speed

task main()
{
    int enable = false, btnState = false;
    while(1)
    {
        enable = SensorValue[StartButton] && !btnState ? !enable : enable;
        btnState = SensorValue[StartButton];

        if(enable)
        {
            wait(5);
            if(SensorValue(SonarF) < 2)/*Determine which Sonar*/
            {
                startMotor(MotorRF, 100);
                startMotor(MotorRM, 100);
                startMotor(MotorRB, 100);
                startMotor(MotorLF, 100);
                startMotor(MotorLM, 100);
                startMotor(MotorLB, 100);
            }
            else if(SensorValue(SonarF) < 20)/*Determine which Sonar*/
            {
                startMotor(MotorRF, 50);
                startMotor(MotorRM, 50);
                startMotor(MotorRB, 50);
                startMotor(MotorLF, 50);
                startMotor(MotorLM, 50);
                startMotor(MotorLB, 50);
            }
            else
            {if(SensorValue(SonarR) < 2)/*Determine which Sonar*/
            {
                startMotor(MotorRF, -50);
                startMotor(MotorRM, -50);
                startMotor(MotorRB, -50);
                startMotor(MotorLF, 50);
                startMotor(MotorLM, 50);
                startMotor(MotorLB, 50);
            }
            else if(SensorValue(SonarR) < 20)/*Determine which Sonar*/
            {
                startMotor(MotorRF, -50);
                startMotor(MotorRM, -50);
                startMotor(MotorRB, -50);
                startMotor(MotorLF, 50);
                startMotor(MotorLM, 50);
                startMotor(MotorLB, 50);
            }
            else
            {if(SensorValue(SonarB) < 2)/*Determine which Sonar*/
            {
                startMotor(MotorRF, -50);
                startMotor(MotorRM, -50);
                startMotor(MotorRB, -50);
                startMotor(MotorLF, -50);
                startMotor(MotorLM, -50);
                startMotor(MotorLB, -50);
            }
            else if(SensorValue(SonarR) < 20)/*Determine which Sonar*/
            {
                startMotor(MotorRF, -50);
                startMotor(MotorRM, -50);
                startMotor(MotorRB, -50);
                startMotor(MotorLF, -50);
                startMotor(MotorLM, -50);
                startMotor(MotorLB, -50);
            }
            else
            	 {if(SensorValue(SonarL) < 2)/*Determine which Sonar*/
            {
                startMotor(MotorRF, 50);
                startMotor(MotorRM, 50);
                startMotor(MotorRB, 50);
                startMotor(MotorLF, -50);
                startMotor(MotorLM, -50);
                startMotor(MotorLB, -50);
            }
            else if(SensorValue(SonarL) < 20)/*Determine which Sonar*/
            {
                startMotor(MotorRF, 50);
                startMotor(MotorRM, 50);
                startMotor(MotorRB, 50);
                startMotor(MotorLF, -50);
                startMotor(MotorLM, -50);
                startMotor(MotorLB, -50);
            }
            else
            {
                startMotor(MotorRF, -50);
                startMotor(MotorRM, -50);
                startMotor(MotorRB, -50);
                startMotor(MotorLF, 50);
                startMotor(MotorLM, 50);
                startMotor(MotorLB, 50);
            }
        }

        }
        wait1Msec(10);
    }
}}
int disable = false;
while (0)
{disable = SensorValue[StartButton] && !btnState ? !disable : disable;
        btnState = SensorValue[StartButton];}
if (disable)
{stopMotor(MotorRF);
	stopMotor(MotorRM);
	stopMotor(MotorRB);
	stopMotor(MotorLF);
	stopMotor(MotorLM);
	stopMotor(MotorLB);
	}
}

working on normal stop. Says that the last while is always false… How do you fix this?

#pragma config(Sensor, dgtl1,  StartButton,    sensorTouch)
#pragma config(Sensor, dgtl2,  SonarF,         sensorSONAR_inch)
#pragma config(Sensor, dgtl4,  StopButton,     sensorTouch)
#pragma config(Sensor, dgtl7,  SonarB,         sensorSONAR_cm)
#pragma config(Sensor, dgtl9,  SonarR,         sensorSONAR_cm)
#pragma config(Sensor, dgtl11, SonarL,         sensorSONAR_cm)
#pragma config(Motor,  port2,           MotorRF,       tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port3,           MotorRM,       tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port4,           MotorRB,       tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port5,           MotorLF,       tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor,  port6,           MotorLM,       tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port7,           MotorLB,       tmotorNone, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

//Project Title: Paoli IN, LRCC Sumobot MK2
//  Team Members: Joshua N Barnett, Xander Phelps
//  Date: 03/04/2020
//  Section: RDI

//Psudocode:

//		button switch pressed
//		scan with front sonar by revolving right
//			(right motors going backwards, and left motors going fowards)
//		once object detected
//			procede towards object at half speed
//		once object within 2 inches
//			procede foward at top speed

task main()
{
    int enable = false, btnState = false;
    while(1)
    {
        enable = SensorValue[StartButton] && !btnState ? !enable : enable;
        btnState = SensorValue[StartButton];

        if(enable)
        {
            wait(5);
            if(SensorValue(SonarF) < 2)/*Determine which Sonar*/
            {
                startMotor(MotorRF, 100);
                startMotor(MotorRM, 100);
                startMotor(MotorRB, 100);
                startMotor(MotorLF, 100);
                startMotor(MotorLM, 100);
                startMotor(MotorLB, 100);
            }
            else if(SensorValue(SonarF) < 20)/*Determine which Sonar*/
            {
                startMotor(MotorRF, 50);
                startMotor(MotorRM, 50);
                startMotor(MotorRB, 50);
                startMotor(MotorLF, 50);
                startMotor(MotorLM, 50);
                startMotor(MotorLB, 50);
            }
            else
            {if(SensorValue(SonarR) < 2)/*Determine which Sonar*/
            {
                startMotor(MotorRF, -50);
                startMotor(MotorRM, -50);
                startMotor(MotorRB, -50);
                startMotor(MotorLF, 50);
                startMotor(MotorLM, 50);
                startMotor(MotorLB, 50);
            }
            else if(SensorValue(SonarR) < 20)/*Determine which Sonar*/
            {
                startMotor(MotorRF, -50);
                startMotor(MotorRM, -50);
                startMotor(MotorRB, -50);
                startMotor(MotorLF, 50);
                startMotor(MotorLM, 50);
                startMotor(MotorLB, 50);
            }
            else
            {if(SensorValue(SonarB) < 2)/*Determine which Sonar*/
            {
                startMotor(MotorRF, -50);
                startMotor(MotorRM, -50);
                startMotor(MotorRB, -50);
                startMotor(MotorLF, -50);
                startMotor(MotorLM, -50);
                startMotor(MotorLB, -50);
            }
            else if(SensorValue(SonarR) < 20)/*Determine which Sonar*/
            {
                startMotor(MotorRF, -50);
                startMotor(MotorRM, -50);
                startMotor(MotorRB, -50);
                startMotor(MotorLF, -50);
                startMotor(MotorLM, -50);
                startMotor(MotorLB, -50);
            }
            else
            	 {if(SensorValue(SonarL) < 2)/*Determine which Sonar*/
            {
                startMotor(MotorRF, 50);
                startMotor(MotorRM, 50);
                startMotor(MotorRB, 50);
                startMotor(MotorLF, -50);
                startMotor(MotorLM, -50);
                startMotor(MotorLB, -50);
            }
            else if(SensorValue(SonarL) < 20)/*Determine which Sonar*/
            {
                startMotor(MotorRF, 50);
                startMotor(MotorRM, 50);
                startMotor(MotorRB, 50);
                startMotor(MotorLF, -50);
                startMotor(MotorLM, -50);
                startMotor(MotorLB, -50);
            }
            else
            {
                startMotor(MotorRF, -50);
                startMotor(MotorRM, -50);
                startMotor(MotorRB, -50);
                startMotor(MotorLF, 50);
                startMotor(MotorLM, 50);
                startMotor(MotorLB, 50);
            }
        }

        }
        wait1Msec(10);
    }
}}
int disable = false;
while (1)
{disable = SensorValue[StartButton] && !btnState ? !disable : disable;
        btnState = SensorValue[StartButton];}
if (disable)
{stopMotor(MotorRF);
	stopMotor(MotorRM);
	stopMotor(MotorRB);
	stopMotor(MotorLF);
	stopMotor(MotorLM);
	stopMotor(MotorLB);
	}
}

It no longer has the error, it just won’t stop if you press the button again


#pragma config(Sensor, dgtl1,  StartStopButton,    sensorTouch)
#pragma config(Sensor, dgtl2,  SonarF,         sensorSONAR_inch)
#pragma config(Sensor, dgtl4,  StopButton,     sensorTouch)
#pragma config(Sensor, dgtl7,  SonarB,         sensorSONAR_cm)
#pragma config(Sensor, dgtl9,  SonarR,         sensorSONAR_cm)
#pragma config(Sensor, dgtl11, SonarL,         sensorSONAR_cm)
#pragma config(Motor,  port2,           MotorRF,       tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port3,           MotorRM,       tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port4,           MotorRB,       tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port5,           MotorLF,       tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor,  port6,           MotorLM,       tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port7,           MotorLB,       tmotorNone, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

//Project Title: Paoli IN, LRCC Sumobot MK2
//  Team Members: Joshua N Barnett, Xander Phelps
//  Date: 03/04/2020
//  Section: RDI

//Psudocode:

//		button switch pressed
//		scan with front sonar by revolving right
//			(right motors going backwards, and left motors going fowards)
//		once object detected
//			procede towards object at half speed
//		once object within 2 inches
//			procede foward at top speed

task main()
{
    int enable = false, btnState = false;
    while(1)
    {
        enable = SensorValue[StartStopButton] && !btnState ? !enable : enable;
        btnState = SensorValue[StartStopButton];

        if(enable)
        {
            wait(5);
            if(SensorValue(SonarF) < 2)/*Determine which Sonar*/
            {
                startMotor(MotorRF, 100);
                startMotor(MotorRM, 100);
                startMotor(MotorRB, 100);
                startMotor(MotorLF, 100);
                startMotor(MotorLM, 100);
                startMotor(MotorLB, 100);
            }
            else if(SensorValue(SonarF) < 20)/*Determine which Sonar*/
            {
                startMotor(MotorRF, 50);
                startMotor(MotorRM, 50);
                startMotor(MotorRB, 50);
                startMotor(MotorLF, 50);
                startMotor(MotorLM, 50);
                startMotor(MotorLB, 50);
            }
            else
            {if(SensorValue(SonarR) < 2)/*Determine which Sonar*/
            {
                startMotor(MotorRF, -50);
                startMotor(MotorRM, -50);
                startMotor(MotorRB, -50);
                startMotor(MotorLF, 50);
                startMotor(MotorLM, 50);
                startMotor(MotorLB, 50);
            }
            else if(SensorValue(SonarR) < 20)/*Determine which Sonar*/
            {
                startMotor(MotorRF, -50);
                startMotor(MotorRM, -50);
                startMotor(MotorRB, -50);
                startMotor(MotorLF, 50);
                startMotor(MotorLM, 50);
                startMotor(MotorLB, 50);
            }
            else
            {if(SensorValue(SonarB) < 2)/*Determine which Sonar*/
            {
                startMotor(MotorRF, -50);
                startMotor(MotorRM, -50);
                startMotor(MotorRB, -50);
                startMotor(MotorLF, -50);
                startMotor(MotorLM, -50);
                startMotor(MotorLB, -50);
            }
            else if(SensorValue(SonarR) < 20)/*Determine which Sonar*/
            {
                startMotor(MotorRF, -50);
                startMotor(MotorRM, -50);
                startMotor(MotorRB, -50);
                startMotor(MotorLF, -50);
                startMotor(MotorLM, -50);
                startMotor(MotorLB, -50);
            }
            else
            	 {if(SensorValue(SonarL) < 2)/*Determine which Sonar*/
            {
                startMotor(MotorRF, 50);
                startMotor(MotorRM, 50);
                startMotor(MotorRB, 50);
                startMotor(MotorLF, -50);
                startMotor(MotorLM, -50);
                startMotor(MotorLB, -50);
            }
            else if(SensorValue(SonarL) < 20)/*Determine which Sonar*/
            {
                startMotor(MotorRF, 50);
                startMotor(MotorRM, 50);
                startMotor(MotorRB, 50);
                startMotor(MotorLF, -50);
                startMotor(MotorLM, -50);
                startMotor(MotorLB, -50);
            }
            else
            {
                startMotor(MotorRF, -50);
                startMotor(MotorRM, -50);
                startMotor(MotorRB, -50);
                startMotor(MotorLF, 50);
                startMotor(MotorLM, 50);
                startMotor(MotorLB, 50);
            }
        }

        }
        wait1Msec(10);
    }
}}}

have an emergency stop that cuts power. don’t need special coding.


#pragma config(Sensor, dgtl1,  StartStopButton, sensorTouch)
#pragma config(Sensor, dgtl2,  SonarF,         sensorSONAR_inch)
#pragma config(Sensor, dgtl4,  StopButton,     sensorTouch)
#pragma config(Sensor, dgtl7,  SonarB,         sensorSONAR_cm)
#pragma config(Sensor, dgtl9,  SonarR,         sensorSONAR_cm)
#pragma config(Sensor, dgtl11, SonarL,         sensorSONAR_cm)
#pragma config(Motor,  port2,           MotorRF,       tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port3,           MotorRM,       tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port4,           MotorRB,       tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port5,           MotorLF,       tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port6,           MotorLM,       tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port7,           MotorLB,       tmotorNone, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

//Project Title: Paoli IN, LRCC Sumobot MK2
//  Team Members: Joshua N Barnett, Xander Phelps
//  Date: 03/04/2020
//  Section: RDI

//Psudocode:

//		button switch pressed
//		scan with front sonar by revolving right
//			(right motors going backwards, and left motors going fowards)
//		once object detected
//			procede towards object at half speed
//		once object within 2 inches
//			procede foward at top speed
// 		once stop cuts power robot turns off.

task main()
{
    int enable = false, btnState = false;
    while(1)
    {
        enable = SensorValue[StartStopButton] && !btnState ? !enable : enable;
        btnState = SensorValue[StartStopButton];

        if(enable)
        {
            wait(5);
            if(SensorValue(SonarF) < 2)/*Determine which Sonar*/
            {
                startMotor(MotorRF, 100);
                startMotor(MotorRM, 100);
                startMotor(MotorRB, 100);
                startMotor(MotorLF, 100);
                startMotor(MotorLM, 100);
                startMotor(MotorLB, 100);
            }
            else {if(SensorValue(SonarF) < 20)/*Determine which Sonar*/
            {
                startMotor(MotorRF, 50);
                startMotor(MotorRM, 50);
                startMotor(MotorRB, 50);
                startMotor(MotorLF, 50);
                startMotor(MotorLM, 50);
                startMotor(MotorLB, 50);
            }
            else
            {if(SensorValue(SonarR) < 2)/*Determine which Sonar*/
            {
                startMotor(MotorRF, -50);
                startMotor(MotorRM, -50);
                startMotor(MotorRB, -50);
                startMotor(MotorLF, 50);
                startMotor(MotorLM, 50);
                startMotor(MotorLB, 50);
            }
            else if(SensorValue(SonarR) < 20)/*Determine which Sonar*/
            {
                startMotor(MotorRF, -50);
                startMotor(MotorRM, -50);
                startMotor(MotorRB, -50);
                startMotor(MotorLF, 50);
                startMotor(MotorLM, 50);
                startMotor(MotorLB, 50);
            }
            else
            {if(SensorValue(SonarB) < 2)/*Determine which Sonar*/
            {
                startMotor(MotorRF, -50);
                startMotor(MotorRM, -50);
                startMotor(MotorRB, -50);
                startMotor(MotorLF, -50);
                startMotor(MotorLM, -50);
                startMotor(MotorLB, -50);
            }
            else if(SensorValue(SonarR) < 20)/*Determine which Sonar*/
            {
                startMotor(MotorRF, -50);
                startMotor(MotorRM, -50);
                startMotor(MotorRB, -50);
                startMotor(MotorLF, -50);
                startMotor(MotorLM, -50);
                startMotor(MotorLB, -50);
            }
            else
            	 {if(SensorValue(SonarL) < 2)/*Determine which Sonar*/
            {
                startMotor(MotorRF, 50);
                startMotor(MotorRM, 50);
                startMotor(MotorRB, 50);
                startMotor(MotorLF, -50);
                startMotor(MotorLM, -50);
                startMotor(MotorLB, -50);
            }
            else if(SensorValue(SonarL) < 20)/*Determine which Sonar*/
            {
                startMotor(MotorRF, 50);
                startMotor(MotorRM, 50);
                startMotor(MotorRB, 50);
                startMotor(MotorLF, -50);
                startMotor(MotorLM, -50);
                startMotor(MotorLB, -50);
            }
            else
            {
                startMotor(MotorRF, -50);
                startMotor(MotorRM, -50);
                startMotor(MotorRB, -50);
                startMotor(MotorLF, 50);
                startMotor(MotorLM, 50);
                startMotor(MotorLB, 50);
            }
        }

        }
        wait1Msec(10);
    }
}}}}

One problem. Only one sonar works…

#pragma config(Sensor, dgtl1,  StartStopButton, sensorTouch)
#pragma config(Sensor, dgtl2,  SonarF,         sensorSONAR_inch)
#pragma config(Sensor, dgtl4,  StopButton,     sensorTouch)
#pragma config(Sensor, dgtl7,  SonarB,         sensorSONAR_cm)
#pragma config(Sensor, dgtl9,  SonarR,         sensorSONAR_cm)
#pragma config(Sensor, dgtl11, SonarL,         sensorSONAR_cm)
#pragma config(Motor,  port2,           MotorRF,       tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port3,           MotorRM,       tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port4,           MotorRB,       tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port5,           MotorLF,       tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port6,           MotorLM,       tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port7,           MotorLB,       tmotorNone, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

//Project Title: Paoli IN, LRCC Sumobot MK2
//  Team Members: Joshua N Barnett, Xander Phelps
//  Date: 03/04/2020
//  Section: RDI

//Psudocode:

//		button switch pressed
//		scan with front sonar by revolving right
//			(right motors going backwards, and left motors going fowards)
//		once object detected
//			procede towards object at half speed
//		once object within 2 inches
//			procede foward at top speed
// 		once stop cuts power robot turns off.

task main()
{
    int enable = false, btnState = false;
    while(1)
    {
        enable = SensorValue[StartStopButton] && !btnState ? !enable : enable;
        btnState = SensorValue[StartStopButton];

        if(enable)
        {
            wait(5);
            if(SensorValue(SonarF) < 2)/*Determine which Sonar*/
            {
                startMotor(MotorRF, 100);
                startMotor(MotorRM, 100);
                startMotor(MotorRB, 100);
                startMotor(MotorLF, 100);
                startMotor(MotorLM, 100);
                startMotor(MotorLB, 100);
            }
            else 
            	{if(SensorValue(SonarF) < 20)/*Determine which Sonar*/
            {
                startMotor(MotorRF, 50);
                startMotor(MotorRM, 50);
                startMotor(MotorRB, 50);
                startMotor(MotorLF, 50);
                startMotor(MotorLM, 50);
                startMotor(MotorLB, 50);
            }
            else
            {if(SensorValue(SonarR) < 2)/*Determine which Sonar*/
            {
                startMotor(MotorRF, -50);
                startMotor(MotorRM, -50);
                startMotor(MotorRB, -50);
                startMotor(MotorLF, 50);
                startMotor(MotorLM, 50);
                startMotor(MotorLB, 50);
            }
            else 
            	{if(SensorValue(SonarR) < 20)/*Determine which Sonar*/
            {
                startMotor(MotorRF, -50);
                startMotor(MotorRM, -50);
                startMotor(MotorRB, -50);
                startMotor(MotorLF, 50);
                startMotor(MotorLM, 50);
                startMotor(MotorLB, 50);
            }
            else
            {if(SensorValue(SonarB) < 2)/*Determine which Sonar*/
            {
                startMotor(MotorRF, -50);
                startMotor(MotorRM, -50);
                startMotor(MotorRB, -50);
                startMotor(MotorLF, -50);
                startMotor(MotorLM, -50);
                startMotor(MotorLB, -50);
            }
            else 
            	{if(SensorValue(SonarR) < 20)/*Determine which Sonar*/
            {
                startMotor(MotorRF, -50);
                startMotor(MotorRM, -50);
                startMotor(MotorRB, -50);
                startMotor(MotorLF, -50);
                startMotor(MotorLM, -50);
                startMotor(MotorLB, -50);
            }
            else
            	 {if(SensorValue(SonarL) < 2)/*Determine which Sonar*/
            {
                startMotor(MotorRF, 50);
                startMotor(MotorRM, 50);
                startMotor(MotorRB, 50);
                startMotor(MotorLF, -50);
                startMotor(MotorLM, -50);
                startMotor(MotorLB, -50);
            }
            else 
            {if(SensorValue(SonarL) < 20)/*Determine which Sonar*/
            {
                startMotor(MotorRF, 50);
                startMotor(MotorRM, 50);
                startMotor(MotorRB, 50);
                startMotor(MotorLF, -50);
                startMotor(MotorLM, -50);
                startMotor(MotorLB, -50);
            }
            else
            {
                startMotor(MotorRF, -50);
                startMotor(MotorRM, -50);
                startMotor(MotorRB, -50);
                startMotor(MotorLF, 50);
                startMotor(MotorLM, 50);
                startMotor(MotorLB, 50);
            }
        }

        }
        wait1Msec(10);
    }
}}}}}}}

maybe?


#pragma config(Sensor, dgtl1,  StartStopButton, sensorTouch)
#pragma config(Sensor, dgtl2,  SonarF,         sensorSONAR_inch)
#pragma config(Sensor, dgtl4,  StopButton,     sensorTouch)
#pragma config(Sensor, dgtl7,  SonarB,         sensorSONAR_cm)
#pragma config(Sensor, dgtl9,  SonarR,         sensorSONAR_cm)
#pragma config(Sensor, dgtl11, SonarL,         sensorSONAR_cm)
#pragma config(Motor,  port2,           MotorRF,       tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port3,           MotorRM,       tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port4,           MotorRB,       tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port5,           MotorLF,       tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port6,           MotorLM,       tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port7,           MotorLB,       tmotorVex393_MC29, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

//Project Title: Paoli IN, LRCC Sumobot MK2
//  Team Members: Joshua N Barnett, Xander Phelps
//  Date: 03/04/2020
//  Section: RDI

//Psudocode:

//		button switch pressed
//		scan with front sonar by revolving right
//			(right motors going backwards, and left motors going fowards)
//		once object detected
//			procede towards object at half speed
//		once object within 2 inches
//			procede foward at top speed
// 		once stop cuts power robot turns off.

task main()
{
    int enable = false, btnState = false;
    while(1)
    {
        enable = SensorValue[StartStopButton] && !btnState ? !enable : enable;
        btnState = SensorValue[StartStopButton];

        if(enable)
        {
            wait(5);
            if(SensorValue(SonarF) < 2)/*Determine which Sonar*/
            {
                startMotor(MotorRF, 100);
                startMotor(MotorRM, 100);
                startMotor(MotorRB, 100);
                startMotor(MotorLF, 100);
                startMotor(MotorLM, 100);
                startMotor(MotorLB, 100);
            }
            else 
            	{if(SensorValue(SonarF) < 20)/*Determine which Sonar*/
            {
                startMotor(MotorRF, 50);
                startMotor(MotorRM, 50);
                startMotor(MotorRB, 50);
                startMotor(MotorLF, 50);
                startMotor(MotorLM, 50);
                startMotor(MotorLB, 50);
            }
            else
            {if(SensorValue(SonarR) < 2)/*Determine which Sonar*/
            {
                startMotor(MotorRF, -50);
                startMotor(MotorRM, -50);
                startMotor(MotorRB, -50);
                startMotor(MotorLF, 50);
                startMotor(MotorLM, 50);
                startMotor(MotorLB, 50);
            }
            else 
            	{if(SensorValue(SonarR) < 20)/*Determine which Sonar*/
            {
                startMotor(MotorRF, -50);
                startMotor(MotorRM, -50);
                startMotor(MotorRB, -50);
                startMotor(MotorLF, 50);
                startMotor(MotorLM, 50);
                startMotor(MotorLB, 50);
            }
            else
            {if(SensorValue(SonarB) < 2)/*Determine which Sonar*/
            {
                startMotor(MotorRF, -50);
                startMotor(MotorRM, -50);
                startMotor(MotorRB, -50);
                startMotor(MotorLF, -50);
                startMotor(MotorLM, -50);
                startMotor(MotorLB, -50);
            }
            else 
            	{if(SensorValue(SonarB) < 20)/*Determine which Sonar*/
            {
                startMotor(MotorRF, -50);
                startMotor(MotorRM, -50);
                startMotor(MotorRB, -50);
                startMotor(MotorLF, -50);
                startMotor(MotorLM, -50);
                startMotor(MotorLB, -50);
            }
            else
            	 {if(SensorValue(SonarL) < 2)/*Determine which Sonar*/
            {
                startMotor(MotorRF, 50);
                startMotor(MotorRM, 50);
                startMotor(MotorRB, 50);
                startMotor(MotorLF, -50);
                startMotor(MotorLM, -50);
                startMotor(MotorLB, -50);
            }
            else 
            {if(SensorValue(SonarL) < 20)/*Determine which Sonar*/
            {
                startMotor(MotorRF, 50);
                startMotor(MotorRM, 50);
                startMotor(MotorRB, 50);
                startMotor(MotorLF, -50);
                startMotor(MotorLM, -50);
                startMotor(MotorLB, -50);
            }
            else
            {
                startMotor(MotorRF, -50);
                startMotor(MotorRM, -50);
                startMotor(MotorRB, -50);
                startMotor(MotorLF, 50);
                startMotor(MotorLM, 50);
                startMotor(MotorLB, 50);
            }
        }

        }
        wait1Msec(10);
    }
}}}}}}}

mostly works, all 6 moters except 1

It all works now. it just wants to spin ti the front when it is turning right or left…

fixed it. just had to reverse the moters that were wrong