Lock posistion of camera but only follow by rotation

I was thinking of making a game where the camera’s position is locked, but only follow an object by rotation, But I don’t know how to.

Could someone explain how?

You can add a script to the camera that has this line on the Update method

transform.LookAt(target);

in which “target” is the transform of the object you want to follow.
This will make the camera rotate towards the object while staying in place