Airsoft solenoid controller

still searching for tutorials on using flags and not finding anything useful. so heres what i have.

const int buttonPin = 3;
const int ledPin = 2;

Boolean buttonPressed = FALSE;

int buttonState = 0;

void setup() {

pinMode(ledPin, OUTPUT);

pinMode(buttonPin, INPUT);

}

void loop() {

buttonState = digitalRead(buttonPin);

if (buttonState == HIGH) {
if button is pressed and buttonPressed is FALSE; // If not already pressed
buttonPressed = TRUE; // Will stop future activation
digitalWrite(ledPin, HIGH);
delay(100);
digitalWrite(ledPin, LOW);

} else {

digitalWrite(ledPin, LOW);
if button is released;
buttonPressed = FALSE; //Will allow to operate next time

}
}

millions of errors but im flailing in the dark here. there must be some kind of examples that i can try out and learn from. I bet its super easy when u know how.