SerialUSB communication return a value for the enterkey after user entered data

Hello,

I am quite new to Arduino and to programming in general ( I have done some C and C++ 10 years ago in school)

So what I am trying to do is to set the intensity of a light
For that, I ask a user to enter a value between 0 and 255, return this value on 2 PWM output so that I can turn on my lights with a certain intensity, EASY!!

But not it seems like the value entered by the user is well copied in my variable but right after that it is erased by '0' or the value returned by the 'enter' button of my keyboard.

I don't know what to do

here is my 'huge' code

#define PWM1 3
#define PWM2 5                   // défini des pins 3 et 5
int x;

void setup() {
  
  pinMode(PWM1, OUTPUT);          //definition du pin mode
  pinMode(PWM2, OUTPUT);


  Serial.begin(9600);          
  Serial.print("Hello !!!   Rentre un numero entre 0 et 255 pour réglere l intensité lumineuse !");
                              
}

void loop() {
 if (Serial.available() > 0) {   // si le port serie contient qqch

    x = Serial.parseInt();        // colle dans x l'info qui est dans serie (mets la en tant que nbr-Int)


  Serial.println(x);     // Ecrit a l ecran la valeur mise dans PWM

 // analogWrite (PWM1,x);  // ecrit la valeur actuel de la lumeie dans PWM
 // analogWrite (PWM2,x);

}
}

I even tried this program Serial.available() - Arduino Reference which should retrun a value of the enter character but it always return 2 values the one relted to the pressed character and then '10' for the enter key

If anybody can guide me to a solution, it would be amazing