Camera transform not following parent

I’m trying to make a script that simply makes my camera follow an empty game object’s position and rotation.
I have an empty game object called cameraPosition, which is a child of my player. I have another empty game object seperate from the player called Cam Holder, which is a parent of the actual camera. In this Cam Holder I have a script that takes the CamPos’ transform, and assigns it to the Cam Holder’s transform.

public Transform camPos;
    void Update()
    {
        transform.position = camPos.position;
    }

This effectively makes the camera follow the Cam Holder/player’s position. However, it does not follow the Cam Holder’s rotation. I tried solving this by
adding

transform.rotation = camPos.rotation;

but this did not do anything. I would love for the camera to follow the CamPos’ rotation, so any help would be much apprichiated. I am very new to coding, so sorry if this is a dumb question.

Hello!.

Sometimes, if you jjust wnt to make the camera follow another object, is much easy to make the camera child of that object, so it will move with it.

But doing if by code its also great.

If what you want, is the camera to point at the object that is beeing folowed, then is musc better to use:

Bye!