Button-led lights code in project

I am making a project with countdown and piezo, that sings a song. But there is a part with button and led light, which doesnt work. The button is supposed to turn on led light when pressed, but it doesnt work for an unknown reason. I marked the parts with button.

#define segA 9
#define segB 7
#define segC 6
#define segD 4
#define segE 5
#define segF 8
#define segG 11
#define CA1 2
#define CA2 3
#include "pitches.h"
int tempo = 140;
int melodie[] = {
  NOTE_G4, 4, NOTE_G4, 8, NOTE_A4, -4, NOTE_G4, -4, NOTE_C5, -4, NOTE_B4, -2, 
  NOTE_G4, 4, NOTE_G4, 8, NOTE_A4, -4, NOTE_G4, -4, NOTE_D5, -4, NOTE_C5, -2,
  NOTE_G4, 4, NOTE_G4, 8, NOTE_G5, -4, NOTE_E5, -4, NOTE_C5, -4, NOTE_B4, -4, NOTE_A4, -4, NOTE_F5, 4, NOTE_E5, 8, NOTE_D5, -4, NOTE_C5,-2,  
};

int Noty = sizeof(melodie) / sizeof(melodie[0]) / 2;
int CelaNota = (60000 * 4) / tempo;
int divider = 0, noteDuration = 0;

const int segs[7] = {segA, segB, segC, segD, segE, segF, segG};
const byte digits[10] = {0b1000000, 0b1111001, 0b0100100, 0b0110000, 0b0011001, 0b0010010, 0b0000010,
0b1111000, 0b0000000, 0b0010000};
const byte letters[4] = {0b0001001,0b0001000, 0b0001100, 0b0011001};

const int buttonPin = 14;
const int ledPin =  13;   
int buttonState = 0;  

void setup() {
  pinMode(ledPin, OUTPUT);      //button problem
  pinMode(buttonPin, INPUT);    //button problem
  
  for(int a = 0; a<=6; a++){
    pinMode(segs[a], OUTPUT);
  }
  pinMode(CA1, OUTPUT);
  pinMode(CA2, OUTPUT);
  
  digitalWrite(12, HIGH);
}

void loop() {
    buttonState = digitalRead(buttonPin);  //button problem
  if (buttonState == HIGH) {  
    digitalWrite(ledPin, HIGH);  
  } 
  else {
    digitalWrite(ledPin, LOW);
  }  //button problem

  zobrazLeve(digits[1]);
  delay(1000);
  for(int digitL = 0; digitL >= 0; digitL--){
    for(int digitR = 9; digitR >= 0; digitR--){
      unsigned long startTime = millis();      
      for(unsigned long trvani=0; trvani < 1000; trvani = millis() - startTime){
        zobrazLeve(digits[digitL]);
        delay(5);
        zobrazPrave(digits[digitR]);
        delay(5);
      }
    }
  }

    for (int Nota = 0; Nota < Noty * 2; Nota = Nota + 2) {
    divider = melodie[Nota + 1];
    if (divider > 0) {
      noteDuration = (CelaNota) / divider;
    } else if (divider < 0) {
      noteDuration = (CelaNota) / abs(divider);
      noteDuration *= 1.5; 
    }
    tone(12, melodie[Nota], noteDuration * 0.9);
    delay(noteDuration);
    noTone(12);
  }

    delay(1000);
    zobrazLeve(letters[0]);
    delay(1000);
    zobrazPrave(letters[1]);
    delay(1000);
    zobrazLeve(letters[2]);
    delay(1000);
    zobrazPrave(letters[2]);
    delay(1000);
    zobrazPrave(letters[3]);
    delay(1000);
    zobrazLeve(digits[1]);
    delay(1000);
    zobrazPrave(digits[8]);
    delay(1000);
}

void zobrazLeve(byte cislice){
  digitalWrite(CA1, LOW);
  digitalWrite(CA2, HIGH);
  zapisCislici(cislice);
}

void zobrazPrave(byte cislice){
  digitalWrite(CA1, HIGH);
  digitalWrite(CA2, LOW);
  zapisCislici(cislice);
}
                     
void zapisCislici(byte cislice){
  for(int i = 0; i < 7; i++){
    int bit = bitRead(cislice, i);
    digitalWrite(segs[i], bit);
  }
}

@cleo321

Your topic was Moved to it's current location / section as it is more suitable and NOT covid related.

Could you also take a few moments to Learn How To Use The Forum.

Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.

What Arduino board are you using?

How is the button switch wired? Is there a pulldown resistor on the switch input?

Where is pin 14 on your board? It is the same as A0 on Uno, Nano.

It takes a very very long time for your loop() to execute because of all of the delays. The switch will be read each iteration of loop(), but it takes about a half of a minute to execute loop(). Hold the switch down and wait and you should see it change after a while ( a bit over 30 seconds).

As long as you are using the, blocking, delay() function the program will never be responsive. These tutorials show how to write non blocking code.
Several things at a time.
Beginner's guide to millis().
Blink without delay().