Where to put camera orbit around player script?

I have been searching around the forums and found a few codes to do what I’m asking for, but I don’t have any idea on where to put the code. I’ve tried making a new script file and copying and pasting the code in there. But that doesn’t work. Also I have tried going into the camera move scripts and using those but they don’t orbit around the player. So I tried deleting everything in that script and pasting that script into there. That didn’t work ether. And after all of this I checked to make sure the programming language was all the same of what type of script document I made. If anyone knows why this is could you tell me what I’m doing wrong?

Ok.

This line:

public Transform player;

means that a variable of Type “Transform” with the name “player” is declared. This variable is meant to reference the Transform component of your player object. The variable will be used by the line

transform.LookAt(player.position);

. However, you never assigned the Transform component of the player object to the variable, so you get the error when the sxcript tries to access it. What you need to do is drag and drop the player object in your hierarchy over to the inspector window when you have the camera object selected. You will see a small field “player” where the orbiting script is. This will automatically assign the Transform component of the player object to the player variable.