How do i get the both motors to work at the same time with a timer?

your code likely reads a joystick to control the motors
just to make sure your wiring is fine, if you test this code, what happens ? (assuming motor1 and motor2 are the right pins)

const byte motor1DirPin = 3;
const byte motor2DirPin = 5;

void setup()
{
  Serial.begin(115200);
  pinMode(motor1DirPin, OUTPUT);
  pinMode(motor2DirPin, OUTPUT);
}

void loop() {

  digitalWrite(motor1DirPin, LOW);
  digitalWrite(motor2DirPin, LOW);
  delay(5000)

  digitalWrite(motor1DirPin, HIGH);
  digitalWrite(motor2DirPin, HIGH);
  delay(5000)

}

if that works then you should explore how to deal with timing: