You have choices, typically for a follow script you will simply get the heading to the target e.g.
[Psedo code]
var heading = targetTransform.position - myTransform.position;
Now heading is a vector that from your position points to your target ... its magnitude is the distance to the target and its normalized form is the direction to the target. This information can be used with whatever method of movement you prefer e.g.
[Psedo code]
myTransform.position += heading.normalized * speed * deltaTime;
This will move myTransform.position toward the target by some speed. To look at the target you have various options as well ... e.g. there is a LookAt option in the transform as I recall that will cause it to snap to face the target e.g.
[Psedo code]
myTransform.LookAt(targetTransfrom.position);
You can learn more about that here https://docs.unity3d.com/ScriptReference/Transform.LookAt.html
You can of course rotate toward as well Documentaiton here https://docs.unity3d.com/ScriptReference/Quaternion.RotateTowards.html In this model you are changing your rotation to match the target rotation limited by some speed
Also if you just want the follow object to match the rotation of the object its following ... e.g. instantly just copy the rotation e.g. myTranform.rotaiton = targetTransform.rotation;
[Psedo code]
var heading = targetTransform.position - myTransform.position;
Now heading is a vector that from your position points to your target ... its magnitude is the distance to the target and its normalized form is the direction to the target. This information can be used with whatever method of movement you prefer e.g.
[Psedo code]
myTransform.position += heading.normalized * speed * deltaTime;
This will move myTransform.position toward the target by some speed. To look at the target you have various options as well ... e.g. there is a LookAt option in the transform as I recall that will cause it to snap to face the target e.g.
[Psedo code]
myTransform.LookAt(targetTransfrom.position);
You can learn more about that here https://docs.unity3d.com/ScriptReference/Transform.LookAt.html
You can of course rotate toward as well Documentaiton here https://docs.unity3d.com/ScriptReference/Quaternion.RotateTowards.html In this model you are changing your rotation to match the target rotation limited by some speed
Also if you just want the follow object to match the rotation of the object its following ... e.g. instantly just copy the rotation e.g. myTranform.rotaiton = targetTransform.rotation;