...
if you wrap your code in [ code] [ /code] tags (without the spaces)
it is sooo much easier to read

//"Arduino Garage Tennis Ball." A distance sensor with LED Stoplights for people with multiple vehicles going into a limited space.
const int triggerPin = 8;
const int echoPin = 9;
int redPin=13;
int yellowPin=12;
int greenPin=11;
long duration;
long distance;
void setup(){
pinMode (13, OUTPUT);
pinMode (12, OUTPUT);
pinMode (11, OUTPUT);
Serial.begin(9600);
}
void loop()
{
int stopDistance=6;//object distance in inches from sensor that you want to trigger the Red LED.
int warnDistance=60;//object distance in inches from sensor that you want to trigger the Yellow LED.
pinMode(triggerPin, OUTPUT);
digitalWrite(triggerPin, LOW);
delayMicroseconds(2);
digitalWrite(triggerPin, HIGH);
delayMicroseconds(5);
digitalWrite(triggerPin, LOW);
pinMode(echoPin, INPUT);
duration = pulseIn(echoPin, HIGH);
distance = duration / 72 / 2;//determines distance in inches of object from sensor by microseconds to inches formula.
if (distance >= warnDistance){
digitalWrite (redPin, LOW);
digitalWrite (yellowPin, LOW);
digitalWrite (greenPin, HIGH);
}
else if((distance>stopDistance) && (distance<warnDistance)){
digitalWrite (redPin, LOW);
digitalWrite (yellowPin, HIGH);
digitalWrite (greenPin, LOW);
}
else{
digitalWrite (redPin, HIGH);
digitalWrite (yellowPin, LOW);
digitalWrite (greenPin, LOW);
}
Serial.println (distance);
}
I would move the setup code at the start of loop into setup
pinMode(triggerPin, OUTPUT);
pinMode(echoPin, INPUT);
you might also want to activate the pullup on echoPin, but that's just a guess