Expected unqualified-id before if. Help greatly appreciated ;)

int trigPin1=2;
int echoPin1=3;

int trigPin2=4;
int echoPin2=5;

int trigPin3=6;
int echoPin3=7;

int trigPin4=8;
int echoPin4=9;

int servoPin = 10;
int pulse = 1500;

void setup()
{
Serial.begin (9600);
pinMode(trigPin1, OUTPUT);
pinMode(echoPin1, INPUT);
pinMode(trigPin2, OUTPUT);
pinMode(echoPin2, INPUT);
pinMode(trigPin3, OUTPUT);
pinMode(echoPin3, INPUT);
pinMode(trigPin4, OUTPUT);
pinMode(echoPin4, INPUT);
pinMode(servoPin, OUTPUT);
}

void loop()
{
long duration1, distance1;
digitalWrite(trigPin1, LOW);
delayMicroseconds(2);
digitalWrite(trigPin1, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin1, LOW);
duration1 = pulseIn(echoPin1, HIGH);
distance1 = (duration1/2) / 29.1;
}
if(distance1 >= 500 || distance1 <= 0)
{
digitalWrite(servoPin,HIGH);
delayMicroseconds(pulse);
digitalWrite(servoPin,LOW);
}

{
delay(2000);
long duration2, distance2;
digitalWrite(trigPin2, LOW);
delayMicroseconds(2);
digitalWrite(trigPin2, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin2, LOW);
duration2 = pulseIn(echoPin2, HIGH);
distance2= (duration2/2) / 29.1;
}
if(distance2 >= 500 || distance2 <= 0)
{
digitalWrite(servoPin,HIGH);
delayMicroseconds(pulse);
digitalWrite(servoPin,LOW);
}

{
delay(2000);
long duration3, distance3;
digitalWrite(trigPin3, LOW);
delayMicroseconds(2);
digitalWrite(trigPin3, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin3, LOW);
duration3 = pulseIn(echoPin3, HIGH);
distance3= (duration3/2) / 29.1;
}
if (distance3 >= 500 || distance3 <= 0)
{
digitalWrite(servoPin,HIGH);
delayMicroseconds(pulse);
digitalWrite(servoPin,LOW);
}

{
delay(2000);
long duration4, distance4;
digitalWrite(trigPin4, LOW);
delayMicroseconds(2);
digitalWrite(trigPin4, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin4, LOW);
duration4 = pulseIn(echoPin4, HIGH);
distance4= (duration4/2) / 29.1;
}
if(distance4 >= 500 || distance4 <= 0) This is where it is flagged
{
digitalWrite(servoPin,HIGH);
delayMicroseconds(pulse);
digitalWrite(servoPin,LOW);
}
All of my squigglies are closed out which is the most common problem with this error code.

Please read "Read this before posting a programming question" at the top of the forum.
If you format your code correctly, more people here will read it.

Those "squiggles" are braces.

In C/C++ you are not allowed to have code outside a function (well, there are exceptions). You have a squiggly bracket that ends the loop function and then you have additional code. Not allowed. "Squigglies" must match but there are other rules as well.

Use the IDE autoformat tool. You will see that you end the loop() function with the first } and all else is outside of loop().

All of my squigglies are closed out which is the most common problem with this error code.

That may be, but they are not in the right places. You can’t just scatter them around and expect the code to work.

Here is your code, properly posted in code tags, with the bad brackets commented out and one added at the end to close loop(). As far as I can tell this is right and it compiles.

int trigPin1 = 2;
int echoPin1 = 3;

int trigPin2 = 4;
int echoPin2 = 5;

int trigPin3 = 6;
int echoPin3 = 7;

int trigPin4 = 8;
int echoPin4 = 9;

int servoPin = 10;
int pulse = 1500;

void setup()
{
   Serial.begin (9600);
   pinMode(trigPin1, OUTPUT);
   pinMode(echoPin1, INPUT);
   pinMode(trigPin2, OUTPUT);
   pinMode(echoPin2, INPUT);
   pinMode(trigPin3, OUTPUT);
   pinMode(echoPin3, INPUT);
   pinMode(trigPin4, OUTPUT);
   pinMode(echoPin4, INPUT);
   pinMode(servoPin, OUTPUT);
}

void loop()
{
   long duration1, distance1;
   digitalWrite(trigPin1, LOW);
   delayMicroseconds(2);
   digitalWrite(trigPin1, HIGH);
   delayMicroseconds(10);
   digitalWrite(trigPin1, LOW);
   duration1 = pulseIn(echoPin1, HIGH);
   distance1 = (duration1 / 2) / 29.1;
   //}
   if (distance1 >= 500 || distance1 <= 0)
   {
      digitalWrite(servoPin, HIGH);
      delayMicroseconds(pulse);
      digitalWrite(servoPin, LOW);
   }

   //{
   delay(2000);
   long duration2, distance2;
   digitalWrite(trigPin2, LOW);
   delayMicroseconds(2);
   digitalWrite(trigPin2, HIGH);
   delayMicroseconds(10);
   digitalWrite(trigPin2, LOW);
   duration2 = pulseIn(echoPin2, HIGH);
   distance2 = (duration2 / 2) / 29.1;
   //}
   if (distance2 >= 500 || distance2 <= 0)
   {
      digitalWrite(servoPin, HIGH);
      delayMicroseconds(pulse);
      digitalWrite(servoPin, LOW);
   }

   //{
   delay(2000);
   long duration3, distance3;
   digitalWrite(trigPin3, LOW);
   delayMicroseconds(2);
   digitalWrite(trigPin3, HIGH);
   delayMicroseconds(10);
   digitalWrite(trigPin3, LOW);
   duration3 = pulseIn(echoPin3, HIGH);
   distance3 = (duration3 / 2) / 29.1;
   //}
   if (distance3 >= 500 || distance3 <= 0)
   {
      digitalWrite(servoPin, HIGH);
      delayMicroseconds(pulse);
      digitalWrite(servoPin, LOW);
   }


   //{
   delay(2000);
   long duration4, distance4;
   digitalWrite(trigPin4, LOW);
   delayMicroseconds(2);
   digitalWrite(trigPin4, HIGH);
   delayMicroseconds(10);
   digitalWrite(trigPin4, LOW);
   duration4 = pulseIn(echoPin4, HIGH);
   distance4 = (duration4 / 2) / 29.1;
   //}
   if (distance4 >= 500 || distance4 <= 0) //This is where it is flagged
   {
      digitalWrite(servoPin, HIGH);
      delayMicroseconds(pulse);
      digitalWrite(servoPin, LOW);
   }
} // added to close loop()

Read the how to use this forum-please read sticky to see how to properly post code and some advice on how to ask an effective question. Remove useless white space and format the code with the IDE autoformat tool (crtl-t or Tools, Auto Format) before posting code.

Thank you so much! this is really helpful