Smoothly---transform.position?

i ve a control code;

var sag : Transform;
var sol : Transform;
var merkez : Transform;
var child : GameObject;
var smoothFallow = 1.0;

function Update () {

if(transform.position.x==merkez.transform.position.x) {

if(Input.GetKeyDown(“right”))

{ transform.position.x = sag.transform.position.x ; }

if(Input.GetKeyDown(“left”))

{ transform.position.x=sol.transform.position.x ;}

}

if(transform.position.x==sol.transform.position.x) {

if(Input.GetKeyDown(“right”))

{ transform.position.x=merkez.transform.position.x; }
}

if(transform.position.x==sag.transform.position.x) {

if(Input.GetKeyDown(“left”))

{ transform.position.x=merkez.transform.position.x; }

}

}

how can i enter my character smoothy?

for example ;

transform.position.x=merkez.transform.position.x*Time.deltaTime;-----> is it right a code for smoothly?

You can try Lerp function:
Here is the documentation.

This should give you the hint!

i seen this but i ve 3 way(left,center,right)

the character s starting center position as game starting

if user puss right button-character goes to right position,

if uses’s position right, character doesnt go to right again…

i didnt make a control system

------in the code(and sag-sol-merkez is right-left-center) ------

Usually, Input.GetAxis is better than Input.GetKeyDown for smooth movement.

ty:)