I was trying to toggle 8 leds with 1 button . Need help!

So i was trying to control 8 leds with only one button like
press once:
B00000001
press twice:
B00000010

But the i just can't write the code can anyone help?
I'm using arduino nano.
Here's the code thats not working as intended:
int latchPin = 4;
int clockPin = 3;
int dataPin = 5;
int buttonPin = 2;
int buttonState = 0;
int buttonPressCount = 0;

byte leds = 0;
void updateShiftRegister()
{
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, LSBFIRST, leds);
digitalWrite(latchPin, HIGH);
}
void setup()
{
pinMode(latchPin, OUTPUT);
pinMode(dataPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(buttonPin,INPUT);
}
void loop()
{
leds = 0;
buttonState = digitalRead(buttonPin);
delay(500);
if (buttonState == HIGH & buttonPressCount == 0){
if (buttonPressCount == 0 & buttonState == HIGH)
digitalWrite(latchPin,LOW);
shiftOut(dataPin,clockPin,MSBFIRST,B00000000);
digitalWrite(latchPin,HIGH);
delay(100);

if (buttonPressCount == 1& buttonState == HIGH)
digitalWrite(latchPin,LOW);
shiftOut(dataPin,clockPin,MSBFIRST,B10000000);
digitalWrite(latchPin,HIGH);
delay(100);

if (buttonPressCount == 2 & buttonState == HIGH)
digitalWrite(latchPin,LOW);
shiftOut(dataPin,clockPin,MSBFIRST,B01000000);
digitalWrite(latchPin,HIGH);
delay(100);

if (buttonPressCount == 3 & buttonState == HIGH)
digitalWrite(latchPin,LOW);
shiftOut(dataPin,clockPin,MSBFIRST,B00100000);
digitalWrite(latchPin,HIGH);
delay(100);

if (buttonPressCount == 4 & buttonState == HIGH )
digitalWrite(latchPin,LOW);
shiftOut(dataPin,clockPin,MSBFIRST,B00010000);
digitalWrite(latchPin,HIGH);
delay(100);

if (buttonPressCount == 5 & buttonState == HIGH)
digitalWrite(latchPin,LOW);
shiftOut(dataPin,clockPin,MSBFIRST,B00001000);
digitalWrite(latchPin,HIGH);
delay(100);

if (buttonPressCount == 6 & buttonState == HIGH)
digitalWrite(latchPin,LOW);
shiftOut(dataPin,clockPin,MSBFIRST,B00000100);
digitalWrite(latchPin,HIGH);
delay(100);

if (buttonPressCount == 7 & buttonState == HIGH)
digitalWrite(latchPin,LOW);
shiftOut(dataPin,clockPin,MSBFIRST,B00000010);
digitalWrite(latchPin,HIGH);
delay(100);

if (buttonPressCount == 8 & buttonState == HIGH)
digitalWrite(latchPin,LOW);
shiftOut(dataPin,clockPin,MSBFIRST,B00000001);
digitalWrite(latchPin,HIGH);
delay(100);
buttonPressCount++;
if(buttonPressCount>8)
buttonPressCount=0;
delay(300);
}
}

  pinMode(buttonPin,INPUT);

How IS that button sewn on?

if(buttonPressCount>8)

It makes no sense to compare buttonPressCount to a smiley face.

  buttonState = digitalRead(buttonPin);
  delay(500);
  if (buttonState == HIGH & buttonPressCount == 0){

The value in buttonState will not change while you have your head in the sand. The logical and operator is &&, not &.

You might not be able to see it, but there is a clear relationship between buttonPressCount and the value that you shift out. You have 8 times as much code as you need, with 8 times as many mistakes.

the button is connected with a pull up resistor. if(buttonPressCount>8) i dont know why the 8 turned into smiley face. As im new to arduino what suggestions and tips do you have for me other than these? I really appreciate your help Thank You!

i dont know why the 8 turned into smiley face.

Because that's what the forum software does when it sees the number 8 followed by a close parentheses.

You can prevent that by using code tags, as the stickies at the top of the forum describe.

what suggestions and tips do you have for me other than these?

The first is to always address ALL of the questions that have been asked.
The second is to use code tags when posting code.
The third is to not try to develop code all at once. Write a little bit of code. Test it. If it produces incorrect results, fix it before adding more code.
The fourth is to avoid Strings and delay()s like the plague.

generally with programming anytime you find yourself repeating blocks of code in your scetch there is almost always an easier way.

usually when you use a button you are not just interested in when the button is down.
you also need to know when the button has changed cause this is where you trigger your effect.
this code uses a variable to remember what the last reading was.

i am not familiar with your shift registers or shiftout or how your pins are working, but i can tell you that if you use an array for your values it will make things much simpler for you.
then you just match the click count directly to the index number

here is how your code should be formated. hopfully you know what you are doing with your pins and outputs.
this is untested but it's the right idea for you.

byte outs [8] {
  //put your values here seperated by commas
  };
bool laststate;
bool state;
int count;
void setup() {
  // put your setup code here, to run once:

}

void loop() {
 if(digitalRead(buttonPin)==HIGH){
  state = true;}else{state=false;}

  if(state!=oldstate){
    if(state){count++;
    if(count>7){count = 0;}

      digitalWrite(latchPin,LOW);   
      shiftOut(dataPin,clockPin,MSBFIRST,outs[count]);     
      digitalWrite(latchPin,HIGH);   
      
      }
      oldstate = state;
    }

delay(10);}

Thank you! So i've been trying some stuff and here's the code that i wrote that seems to work:

int tDelay = 500;
int latchPin = 11;
int clockPin = 9;
int dataPin = 12;
int buttonPin = 2;
byte leds = 0;
bool button_old = true;
bool button_new;
                
void updateShiftRegister()
{
   digitalWrite(latchPin, LOW);
   shiftOut(dataPin, clockPin, LSBFIRST, leds);
   digitalWrite(latchPin, HIGH);
}

void setup()
{
  pinMode(latchPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(buttonPin, INPUT);
  updateShiftRegister();
}

void loop()
{
  button_new = digitalRead(buttonPin);
  if(button_new != button_old)
  {
    if(button_new == false)
    {
      leds = leds << 1;
      if(leds == 0b00000000)
      {
        leds = 0b00000001;
      }
      updateShiftRegister();
    }
    button_old = button_new;
  }
  delay(tDelay);
}

Have another shot at reading reply #3.
PaulS explains why you're not getting good posts.

Also - rememner that CTRL-T in the IDE.