Keeping a servo at the same position while running DC motors

Hi everyone,

#include <Servo.h>
#include <AFMotor.h>
AF_DCMotor Motor1(1, MOTOR12_1KHZ); //Setting Variables for DC motors
AF_DCMotor Motor2(2, MOTOR12_1KHZ); //Only these two motors are affected in change of frequency can be 64KHZ, 8KHZ, 2khz or 1KHZ
AF_DCMotor Motor3(3, MOTOR12_1KHZ); //Motor 3 and 4 will always run at 1KHz it will ignore any setting given
AF_DCMotor Motor4(4, MOTOR12_1KHZ); //For the case of presentation change these settings to 1KHz
Servo claw; //Name of servo

String readString;

int pos = 0; //Placeholder value for servo posistion

void setup() {
  Serial.begin(9600);
  Motor1.setSpeed(250); //Speed set for the motors this can be anywhere between 0-255
  Motor2.setSpeed(250);
  Motor3.setSpeed(250);
  Motor4.setSpeed(250);
  claw.attach(10); //Attach servo signal wire to pin 10
}

void loop() {
  while(Serial.available()){
    delay(50);
    char c=Serial.read();
    readString+=c;
  }
  //Forward Motion
  if(readString.length()>0){
    Serial.println(readString);
    if (readString =="Forward"){ 
      Motor2.run (FORWARD);
      Motor3.run (FORWARD);
      delay(400);
      claw.detach();
    }
  //Backward Motion
    if (readString =="Reverse"){
      Motor1.run (BACKWARD); //Reverse motion to go backward
      Motor4.run (BACKWARD);
      delay(400);
      claw.detach();
    }
  //Right Motion with only two motors running
    if (readString =="Right"){
      Motor3.run (FORWARD);
      Motor4.run (FORWARD);
      delay(400);
      claw.detach();
    }
  //Left Motion with only two motors running
    if (readString =="Left"){
      Motor1.run (FORWARD);
      Motor2.run (FORWARD);
      delay(400);
      claw.detach();
    }
    if (readString =="Stop"){
      Motor1.run (RELEASE);
      Motor2.run (RELEASE);
      Motor3.run (RELEASE);
      Motor4.run (RELEASE);
      delay(400);
      claw.detach();
    }
    if (readString !="Stop","Left","Right","Forward","Reverse")
    {
      claw.attach(10);
      int pos = readString.toInt();
      claw.write(pos);
      delay(15);  
    }
    

    readString="";
  }
}

This is my code and I’m attempting to have my car move to an item, pick up said item and drive away with it. Currently I have tried a few different ways to try to keep the claw close, such as using the detach function, which didn’t do anything for me. Currently this program allows the car and claw to move but while moving the claw reverts to being open, until I instruct it to close again. If anyone would be able to help me out it would be much appreciated.

You should not be detaching the servo at all. Why are you?

    if (readString !="Stop","Left","Right","Forward","Reverse")

I am certain that that does not do what you think it does.

I thought that in between the movements it would leave the servo motor in the position I changed it to.
I believe you're right about that, instead of that line I put an Else instead