I can't add my script to a boss

public class FirstBossBhv : MonoBehaviour
{

public float speed;

public GameObject projectile;

private bool movingRight = true;

private bool movingLeft = false;

public Rigidbody2D rb2d;

void Update()
{
    if(movingRight == true)
    {
        rb2d.velocity = transform.right * speed;
    }else if(movingLeft == true)
    {
        rb2d.velocity = transform.right * -speed;
    }
}

private void OnCollisionEnter2D(Collision2D collision)
{
    if (collision.gameObject.CompareTag("2Walls"))
    {
        if(movingRight == true && movingLeft == false)
        {
            movingRight = false;
            movingLeft = true;
        }else if (movingRight == false && movingLeft == true)
        {
            movingRight = true;
            movingLeft = false;
        }
    }
}

}

When I try to attach it to my boss, this error pops out, any help?[137122-στιγμιοτυπο-οθονης-11.png|137122]

Is your file name the same as your class name?

Your bosspawn.cs file has an error stopping the compiler. You need to fix that. The error indicates that you are trying to instantiate without telling it what to instantiate. Line number and file name are in the error message.