Hover Car Complier Problems

Hi I am new to using Unity and I keep finding I am getting script problems even though I am copying and pasting script For example I wish to make a Battlezone 1 AND 2 R.T.S style but on actual cyber planets. My current problem is to

1)Get enemy an friendly a.i to walk or run about on a planet or sphere
2) Get them to go into a vehicle and come after the player and the players allies in a vehicle
3) Flying vehicles actually following the curvature of the planet and yet fly off planet as well
I have the Faux Gravity and the First Person :Spherical Worlds resources from youtube working but I having a lot of difficulty adding other scripts because even when its debugged clean I get some "can’t add script " class error.

With this script I got for a hover car which I intend to turn into a strafing hover tank I am getting a "expected class,delegate,enum, interface or struct error

Can anyone help me here please?

using UnityEngine;
using System.Collections;
public float speed = 90f;
public float turnSpeed = 5f;
public float hoverForce = 65f;
public float hoverHeight = 3.5f;
private float powerInput;
private float turnInput;
private Rigidbody carRigidbody;


void Awake ()
{
    carRigidbody = GetComponent <Rigidbody>();
}

void Update ()
{
    powerInput = Input.GetAxis ("Vertical");
    turnInput = Input.GetAxis ("Horizontal");
}

void FixedUpdate()
{
    Ray ray = new Ray (transform.position, -transform.up);
    RaycastHit hit;

    if (Physics.Raycast(ray, out hit, hoverHeight))
    {
        float proportionalHeight = (hoverHeight - hit.distance) / hoverHeight;
        Vector3 appliedHoverForce = Vector3.up * proportionalHeight * hoverForce;


        carRigidbody.AddForce(appliedHoverForce, ForceMode.Acceleration);
    }

    carRigidbody.AddRelativeForce(0f, 0f, powerInput * speed);
    carRigidbody.AddRelativeTorque(0f, turnInput * turnSpeed, 0f);

    }
}

Sorry about that sovled the first error but the can use script error still is unsolved

Umm… where is the class definition? You just have a list of methods. Are you new to c#?

Also code tags please.

Yeah I did say I solved that and yeah I am kind of new to C# though this isn’t my code I got it off the Hover Car tutorial

Ok, so what is the error ?

This?

Yeah I was getting that I think I solved that because I didn’t notice until too late that there was no class definition in the script I made a player hovertank out of the First Person Controller example from spherical worlds but I can’t get it to jump as I also can’t get the first person controller to jump and I want to disable it until the player gets into it or A.I enemy gets into it

Here is the first person controller script

using UnityEngine;
using System.Collections;

    [RequireComponent (typeof (GravityBody))]
public class FirstPersonController : MonoBehaviour {
     
            // public vars
        public float mouseSensitivityX = 250;
        public float mouseSensitivityY = 250;
        public float walkSpeed = 8;
        public float jumpForce = 220;
        public LayerMask groundedMask;
     
            // System vars
                bool grounded;
        Vector3 moveAmount;
        Vector3 smoothMoveVelocity;
        float verticalLookRotation;
        Transform cameraTransform;
        Rigidbody rigidbody;
     
         
        void Awake() {
                Screen.lockCursor = true;
                cameraTransform = Camera.main.transform;
                rigidbody = GetComponent<Rigidbody> ();
            }
     
        void Update() {
             
                    // Look rotation:
                        transform.Rotate(Vector3.up * Input.GetAxis("Mouse X") * mouseSensitivityX * Time.deltaTime);
                verticalLookRotation += Input.GetAxis("Mouse Y") * mouseSensitivityY * Time.deltaTime;
                verticalLookRotation = Mathf.Clamp(verticalLookRotation,-60,60);
                cameraTransform.localEulerAngles = Vector3.left * verticalLookRotation;
             
                    // Calculate movement:
                        float inputX = Input.GetAxisRaw("Horizontal");
                float inputY = Input.GetAxisRaw("Vertical");
             
                    Vector3 moveDir = new Vector3(inputX,0, inputY).normalized;
                Vector3 targetMoveAmount = moveDir * walkSpeed;
                moveAmount = Vector3.SmoothDamp(moveAmount,targetMoveAmount,ref smoothMoveVelocity,.15f);
             
                    // Jump
                if (Input.GetButtonDown("Jump")) {
                        if (grounded) {
                                rigidbody.AddForce(transform.up * jumpForce);
                            }
                    }
             
                    // Grounded check
                        Ray ray = new Ray(transform.position, -transform.up);
                RaycastHit hit;
             
                if (Physics.Raycast(ray, out hit, 1 + .1f, groundedMask)) {
                        grounded = true;
                    }
                else
                   {
                        grounded = false;
                    }
             
            }
     
        void FixedUpdate() {
                // Apply movement to rigidbody
                    Vector3 localMove = transform.TransformDirection(moveAmount) * Time.fixedDeltaTime;
                rigidbody.MovePosition(rigidbody.position + localMove);
            }
    }

And here is the hovertank script:

using UnityEngine;
using System.Collections;

    [RequireComponent (typeof (GravityBody))]
public class FirstPersonHoverTankController : MonoBehaviour {
     
            // public vars
        public float mouseSensitivityX = 250;
        public float mouseSensitivityY = 250;
        public float hoverSpeed = 20;
        public float jumpForce = 1000f;
       public float hoverForce = 65f;
       public float hoverHeight = 3.5f;
        public LayerMask groundedMask;
     
            // System vars
        bool grounded;
        Vector3 moveAmount;
        Vector3 smoothMoveVelocity;
        float verticalLookRotation;
        Transform cameraTransform;
        Rigidbody hoverRigidbody;
     
         
        void Awake() {
                Screen.lockCursor = true;
                cameraTransform = Camera.main.transform;
                hoverRigidbody = GetComponent<Rigidbody> ();
            }
     
        void Update() {
             
                    // Look rotation:
                transform.Rotate(Vector3.up * Input.GetAxis("Mouse X") * mouseSensitivityX * Time.deltaTime);
                verticalLookRotation += Input.GetAxis("Mouse Y") * mouseSensitivityY * Time.deltaTime;
                verticalLookRotation = Mathf.Clamp(verticalLookRotation,-20,20);
                cameraTransform.localEulerAngles = Vector3.left * verticalLookRotation;
             
                    // Calculate movement:
                float inputX = Input.GetAxisRaw("Horizontal");
                float inputY = Input.GetAxisRaw("Vertical");
             
                Vector3 moveDir = new Vector3(inputX,0, inputY).normalized;
                Vector3 targetMoveAmount = moveDir * hoverSpeed;
                moveAmount = Vector3.SmoothDamp(moveAmount,targetMoveAmount,ref smoothMoveVelocity,.15f);
             
                    // Jump
                if (Input.GetButtonDown("Jump")) {
                        if (grounded) {
                                hoverRigidbody.AddForce(transform.up * jumpForce);
                            }
                    }
             
                    // Grounded check
                        Ray ray = new Ray(transform.position, -transform.up);
                RaycastHit hit;
             
                if (Physics.Raycast(ray, out hit, 1 + .1f, groundedMask)) {
                        grounded = true;
                    }
                else {
                        grounded = false;
                    }
             
            }
     
        void FixedUpdate() {
                // Apply movement to rigidbody
                    Vector3 localMove = transform.TransformDirection(moveAmount) * Time.fixedDeltaTime;
                hoverRigidbody.MovePosition(hoverRigidbody.position + localMove);
            }
    }

I think somehow I would need a vehicle attractor script for the a.i to get into the tank if the player isn’t in the tank though right now what I really need is a.i to be able to walk run and drive around a sphere

Solved the A.I walking on a sphere problem now its just getting the player and A.I to get in and out of vehicles