2d click to move

So I am making a 2D game and every time I clicked on the screen space, my player would swims upward by a little bit. My next goal is to get my player to move left or right. So how do i make my player move right once i click on the right side of the screen space? I tried with …

target = Camera.main.ScreenToWorldPoint (Input.mousePosition);

it works ok but it’s not what i want. I don’t want my player to follow the mousePosition, i just want it to move right once the right side of the screen space is clicked. if i clicked left, it goes left.

I also tried …

if (target.x <= target.z)
      {
         transform.position = new Vector3( 5, 0, 0);
      }

but that kind a transport my character to where i clicked.
Sorry, i didn’t upload the script. my entire script is too messy right now because I’ve tried many different method to get this to work but no luck.

void Update () {

		if(Input.GetKey(KeyCode.Mouse0)){
			if(Input.mousePosition.x > Screen.width / 2){

				Debug.Log("moving right");
				transform.Translate(Vector3.right * speed * Time.deltaTime);
			}
			else{

				Debug.Log("moving left");
				transform.Translate(-Vector3.right * speed * Time.deltaTime);
			}
		}
	
	}

You are setting the transform position to 5,0,0. If you want to move it you have to translate it or add to the positions. For example this would teleport your character to the right:

 transform.position += new Vector3( 5, 0, 0);