why is it not letting me use transform?

I am trying to make my camera follow my character but i can’t get it to work so I tried some scripts of the internet but none work as it says there is compiler errors on my computer but i can never work out why? For example

does anyone know why it is working for others but not me and why transform is considered an invalid global code and why it wont let me use transform after the private object and could someone please give me a working script for get the camera to follow the player in 3 person if the scripts I have been using are wrong and it isn’t just me

Please take all of the variables declared in Start() block and put them outside the start function.
Further i think there is no need of “private object transform;” so you can comment out that line also.

Right your private object transform is outside the class. Also Transform is a better way to define a transform variable.

You should normally have the following structure in C# files

using UnityEngine;                                          // The using lines at the top
    public class myClass : MonoBehaviour {    // The class and parent class
         private Transform myTransform;          // Your declared variables
         public GameObject go;
         void Start()                                                 // The Start Finction

Your script is pretty much wrong in so many places I’d really recommend you do some of the tutorials, it’ll seem like it takes a while to watch them but if you understand the concepts you’ll be up and running a lot faster.

c# scripting tutorials