Light Sensors to control Servo

I'm trying to use two light sensors two sense which direction the brightest light source is and then rotate the servo to face it.

The way it's supposed to work is I compare the left and right values after rounding the numbers, if the right one is more in the light than the left one rotate clockwise. If the left one is more in the light rotate counterclockwise and if they're equal don't move.

I'm having some issues with it right now. It just kinda doesn't work and I don't know what to do. If there are any arduino wizards who can help I would greatly appreciate it

 #include <Servo.h>
//Setup the integers and servo
int leftLightSensor = A1;
int rightLightSensor = A0;
int leftAnalogValue = 0;
int rightAnalogValue = 0;
int leftRoundedValue = 0;
int rightRoundedValue = 0;
int servoPin = 8;
Servo myServo;

//Attach the servo to the digital pin
void setup() {
  // put your setup code here, to run once:
  myServo.attach(servoPin);
  Serial.begin(9600);
}

//Do all the things
void loop() {
  // put your main code here, to run repeatedly:
  leftAnalogValue = analogRead(leftLightSensor);
  rightAnalogValue = analogRead(rightLightSensor);
  leftRoundedValue = 10*((leftAnalogValue + 50) / 10);
  rightRoundedValue = 10*((rightAnalogValue + 50) / 10);
  Serial.println(leftRoundedValue);
  Serial.println(rightRoundedValue);
  delay(200);
  
  
  if(leftRoundedValue > rightRoundedValue){
    while(leftRoundedValue > rightRoundedValue){
    myServo.write(180);
  }
  if(rightRoundedValue > leftRoundedValue){
    myServo.write(0);
  }
  if(leftRoundedValue == rightRoundedValue){
    myServo.write(92);
  }
}

I posted the wrong version of the code... Here is the version I currently am on

 #include <Servo.h>
//Setup the integers and servo
int leftLightSensor = A1;
int rightLightSensor = A0;
int leftAnalogValue = 0;
int rightAnalogValue = 0;
int leftRoundedValue = 0;
int rightRoundedValue = 0;
int servoPin = 8;
Servo myServo;

//Attach the servo to the digital pin
void setup() {
  // put your setup code here, to run once:
  myServo.attach(servoPin);
  Serial.begin(9600);
}

//Do all the things
void loop() {
  // put your main code here, to run repeatedly:
  leftAnalogValue = analogRead(leftLightSensor);
  rightAnalogValue = analogRead(rightLightSensor);
  leftRoundedValue = 10*((leftAnalogValue + 50) / 10);
  rightRoundedValue = 10*((rightAnalogValue + 50) / 10);
  Serial.println(leftRoundedValue);
  Serial.println(rightRoundedValue);
  delay(200);
  
  
  if(leftRoundedValue > rightRoundedValue){
    myServo.write(180);
  }
  if(rightRoundedValue > leftRoundedValue){
    myServo.write(0);
  }
  if(leftRoundedValue == rightRoundedValue){
    myServo.write(92);
  }
}

Do you have a barrier between the two sensors that will shade the sensor on the far side when the near side is lit?

" It just kinda doesn't work and I don't know what to do. "
Can you be WAY more specific? Do the values you display act a you intended? You should get two numbers between 50 and 1070 that are multiples of 10.

Maybe, instead of moving the servo all the way to the left or right you should just add or subtract a small number from the desired position. For example,

  if(leftRoundedValue > rightRoundedValue && position < 180) {
    position++;
  }
  if(rightRoundedValue > leftRoundedValue && position > 0){
    position--;
  }
  myServo.write(position);

Well you could make some changes until "it just kinda DOES work".

Or you could you say what kinda not working means in some useful detail like what does happen as the light moves from left to right and how that's different from what you wanted?

Steve