2222a transistor as a switch

in theory: when the momentary button is pressed the attiny85 sends a signal to the 2222a, the transistor grounds the solenoid valve to turn it on.

What is happening: When the momentary button is pressed sometimes the solenoid valve is engaged, sometimes the valve clicks rapidly, and sometimes the valve receives current but it does not seem to be enough current to engage the valve.

the LM7805 is a 5vdc regulator

const int SwitchPin = 2;     // the number of the switch pin
const int RelayPin =  0;      // the number of the Relay pin

// variables will change:
int buttonState = 0;         // variable for reading the pushbutton status

void setup() {
  // initialize the Relay pin as an output:
  pinMode(RelayPin, OUTPUT);      
  // initialize the pushbutton pin as an input:
  pinMode(SwitchPin, INPUT);     
}

void loop(){
  // read the state of the pushbutton value:
  buttonState = digitalRead(SwitchPin);

  // check if the pushbutton is pressed.
  // if it is, the buttonState is HIGH:
  if (buttonState == HIGH) {     
    // turn LED on:    
    digitalWrite(RelayPin, HIGH); 
    delay(5000); 
  } 
  else {
    // turn LED off:
    digitalWrite(RelayPin, LOW); 
  }
}

Thank you again... please let me know if I left out anything pertinent