Anything wrong with this code? Sorry for any grammar mistakes. It's my second language.

I had a little test with my Arduino Uno R3 I connected 2 buttons to power , GND using 10k resistors and pins 2 and 4.
I connected piezo to power and ground.

When you pressed a button1 then you should hear 'c' tone,
but when I pressed the second button nothing happend and I don't understand why?

Here is my code below:

const int buttonPin2 = 4;
const int buttonPin1 = 2;   
const int piezopin =  6;      


int buttonState1 = 0;
int buttonState2 = 0;        

void setup() {

  pinMode(piezopin, OUTPUT);
  pinMode(buttonPin2,INPUT);
  pinMode(buttonPin1, INPUT);
}

void loop() {

  buttonState1 = digitalRead(buttonPin1);
  buttonState2 = digitalRead(buttonPin2);



  if (buttonState1 == HIGH) {
    tone(6,261.63,500);

  } else {



  }
  if (buttonState2 == HIGH) {
    tone(6,392.00,500);
  } else {

  }
Try calling noTone() after the tone is played. This is a kind of "reset" for the pin.

Also, you forgot a } at the end of your code.

If these didn't solve your code, then it most probably is an electric problem.