How do I rotate an object towards mouseclick?

I try to do it, but I do something wrong. I’m junior in this sphere, and yet I didn’t understand the connection between mouse click coordinates and current gameobject. PLEASE help me to solve the problem. Advance thank you …

		var mousePos = Input.mousePosition;
			mousePos.z = 100.0f; //The distance from the camera to the player object
			Vector3 lookPos  = Camera.main.ScreenToWorldPoint(mousePos);
			var gameobjPos = Camera.main.ScreenToWorldPoint(transform.position);
			transform.Rotate(0,((lookPos.y/lookPos.y)*(Mathf.Abs(lookPos.y)-Mathf.Abs(gameobjPos.y))),0);

You could do

var mousePos = Camera.mainScreentoWorldPoint(Input.mousePosition);
mousePos.y = transform.y;
transform.LookAt(mousePos);

The second argument of LookAt defines the Up axis of the world, and it defaults to Y-axis, so change it accordingly.