Problems with Proximity AI Script

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Opponent : MonoBehaviour {

public class Ball;
float range;
float speed;
Rigidbody rb;

void Start()
{
rb=GetComponent<Rigidbody>();
}

void Update()
{

range = Vector3.Distance(Ball.transform.position, transform.position);

if (range < 40)
{
transform.LookAt(Ball.transform.position);
}

if (range < 30 && range > 15)
{
rb.AddForce(Vector3.forward*25*speed);
}
}
}

I need some help with this code, it is meant to be a script for an AI that will chase a ball. I have been working on it for a few weeks for a school project but I am still getting a compiler error telling me that I am missing { and } somewhere within the script. I have tried multiple positions and looked at other forums for help but I am still getting the error. Can anyone help me out or point out where I have gone wrong with the end brackets? Thanks

Change this line

public class Ball;

to

public GameObject Ball;

The reason it’s complaining about brackets is because it thinks you’re trying to declare another class due to this error.

Thank you very much it finally solved the problem, now all I have to do is identify the Opponent’s Speed value. Thanks I’ve been stuck for like 2 weeks on this.