rotating a camera to face an object

so i want to create a 3d menu that the camera rotates on an event. for now im trying to rotate it at the start of the game and have it face a game object.

i declared the camera at myTransform and the target object at Transform. however it just sits there and dont do nothing.

here is my code:

#pragma strict
var myTransform: Transform; //Object you want to rotate
var target: Transform; //The game object that you want to face
var rotationSpeed: float = 5;

function Start () {

myTransform.rotation = Quaternion.Slerp(myTransform.rotation, Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed*Time.deltaTime);

}

For this to work, you need to call it each frame, but you are only calling it once at the beginning of the game. Change “Start()” to “Update()”, and it should work.

function Update () {
 
myTransform.rotation = Quaternion.Slerp(myTransform.rotation, Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed*Time.deltaTime);
}