Hit the ball with Cds and Servo motor

Hi, I want to hit the ball falling from slide.

If first Cds goes down to 300, check the first time, and second Cds goes down to 300, check the second time.

After that, calculate the speed of ball and the time when the ball is falling, then hit the ball with servo motor.

I used millis, but there are so many recorded times. I want to record the initial time.

How can I fix this? Here is my cord.

#include <Servo.h>

const int pinSen1 = 13;
const int pinSen2 = 12;
const int pinCds1 = A0;
const int pinCds2 = A1;

const int pinSrv = 7;
Servo myServo;

unsigned long oldtime1;
unsigned long newtime1;
unsigned long oldtime2;
unsigned long newtime2;

int value1;
int value2;

void setup() {
pinMode(pinSen1,OUTPUT);
pinMode(pinSen2,OUTPUT);
digitalWrite(pinSen1,HIGH);
digitalWrite(pinSen2,HIGH);
Serial.begin(9600);

myServo.attach(pinSrv);
}

void loop() {

value1 = analogRead(pinCds1);
value2 = analogRead(pinCds2);
Serial.print(value1);
Serial.print(" : ");
Serial.println(value2);
delay(10);

if(value1 > 200 and value1 < 450){
oldtime1 = millis();
Serial.print("time1 = ");
Serial.println(oldtime1);
}

if(value2 > 200 and value2 < 500){
oldtime2 = millis();
Serial.print("time2 = ");
Serial.println(oldtime2);
}

int dt, hittime;
dt = oldtime2 - oldtime1;
hittime = oldtime2+dt+1000;
Serial.println(dt);

if (millis() == hittime){
myServo.write(90);
delay(10);
}
else{
myServo.write(0);
delay(10);
}
}

there are so many recorded times. I want to record the initial time.

Look at the StateChangeDetection example in the IDE to see how to do it. Basically, save the previous detector state, compare it with the current detector state and if the ball is now detected, only then save the value from millis()