noobie with error message

I get the error message "a function-definition is not allowed here before '{'token
Here is my code.

 void setup() {
  //configure all LEDs as output
  pinMode(carRed, OUTPUT);
  pinMode(carYellow, OUTPUT);
  pinMode(carGreen, OUTPUT);
  pinMode(pedRed, OUTPUT);
  pinMode(pedGreen, OUTPUT);
  pinMode(button, INPUT);    //configure button as input
          digitalWrite(carGreen, HIGH); //initialize green traffic light on
       digitalWrite(pedRed, LOW);   //initialize red pedestrian light off}
       void loop(){
        int state = digitalRead(button);
        // test if the button is pressed and if 5 seconds have passed after it is pressed lately.
        if(state ==HIGH &&(millis()-changeTime)> 5000){
          //carry out the function of changing LED
          changeLights();
        }
       }
       void changeLights(){
        digitalWrite(carGreen, LOW);   //green traffic light off
        digitalWrite(carYellow, HIGH); //yellow traffic light on
        delay(2000);                   //wait for 2 secs

        digitalWrite(carYellow, LOW);  //yellow traffic light off
        digitalWrite(carRed, HIGH);    //red traffic light on
        delay(1000);                   //wait for 1 sec for safety reason
        
        digitalWrite(pedRed, LOW);     //red pedestrian light off
        digitalWrite(pedGreen, HIGH);  //light pedestrian light on

        delay(crossTime);              //time for crossing street

        //blink green pedestrian light to notify pedestrians to pass soon
        for(int x=0;x<10;x++){
          digitalWrite(pedGreen, HIGH);
          delay(250);
          digitalWrite(pedGreen, LOW);
          delay(500);
        }
        digitalWrite(pedRed, HIGH);    //red pedestrian light on
        delay(500);

        digitalWrite(carRed, LOW);     //red traffic light off
        digitalWrite(carYellow, HIGH); //yellow traffic lighton
        delay(1000);
        digitalWrite(carYellos, LOW);  //yellow traffic light off
        digitalWrite(carGreen, HIGH);  //green traffic light on

        changeTime = millis()          //record the duration since last change
        //back to the loop of main code
       }

Welcome,

Your problem is on this first line. Can you see it and solve it?

       digitalWrite(pedRed, LOW);   //initialize red pedestrian light off}
       void loop(){

While you have your code in the IDE, use the Ctrl-T key sequence to reformat your code before posting. It often may help you see errors like this.

econjack: While you have your code in the IDE, use the Ctrl-T key sequence to reformat your code before posting. It often may help you see errors like this.

This step (which is often ignored) should be standard whenever you make changes and recompile. It's really easy to accidentally leave something out. Formatting will make it obvious.