Having trouble linking camera in my script?

Hello, my game objects “formations” are not moving properly… They move to the right and get stuck. I am getting the error

MissingComponentException: There is no ‘Camera’ attached to the “EnemySpawners” game object, but a script is trying to access it.You probably need to add a Camera to the game object “EnemySpawners”. Or your script needs to check if the component is attached before using it.FormationController.Start () (at Assets/Enemies/FormationController.cs:17)

I tried changing camera to Camera, but that did not help I am rather confused on how to link the same camera in different scripts, because right now the camera is attached to my player sprite and follows the ship around in a different script.

Here is my code,

using UnityEngine;
using System.Collections;

public class FormationController : MonoBehaviour
{   //Spawning Variables
    public GameObject EnemyPrefab;
    public float W = 10, H = 5;
    //Movement Variables
    public float Speed = 5;
    private int Direction;
    private float BoundaryRightEdge, BoundaryLeftEdge;
    public float Padding = 0.25f;


    void Start() //Setting Boundary
    {   Camera camera = GetComponent<Camera>();
        float distance = transform.position.z - camera.transform.position.z;
        BoundaryLeftEdge = camera.ViewportToWorldPoint(new Vector3(0, 0, distance)).x + Padding;
        BoundaryRightEdge = camera.ViewportToWorldPoint(new Vector3(1, 1, distance)).x - Padding;
       
        
        //Spawn at each Enemy Formation Game Object
        foreach (Transform child in transform)
        {
            GameObject enemy = Instantiate(EnemyPrefab, child.transform.position, Quaternion.identity) as GameObject;
            enemy.transform.parent = child;
        }

    }

    void OnDrawGizmos()
    {
        float xmin, xmax, ymin, ymax;
        xmin = transform.position.x - 0.5f * W;
        xmax = transform.position.x + 0.5f * W;
        ymin = transform.position.y - 0.5f * H;
        ymax = transform.position.y + 0.5f * H;
        Gizmos.DrawLine(new Vector3(xmin, ymin, 0), new Vector3(xmin, ymax, 0));
        Gizmos.DrawLine(new Vector3(xmin, ymax, 0), new Vector3(xmax, ymax, 0));
        Gizmos.DrawLine(new Vector3(xmax, ymax, 0), new Vector3(xmax, ymin, 0));
        Gizmos.DrawLine(new Vector3(xmax, ymin, 0), new Vector3(xmin, ymin, 0));

    }

    void Update()
    {   float FormationRightEdge = transform.position.x + 0.5f * W;
        float FormationLeftEdge = transform.position.x - 0.5f * W;
        if (FormationRightEdge > BoundaryRightEdge)
        {
            Direction = -1;
        }
        if (FormationLeftEdge < BoundaryLeftEdge){
            Direction = 1;
        }
        transform.position += new Vector3(Direction * Speed * Time.deltaTime, 0, 0);

        //Spawn Enemies on Keypress
        if (Input.GetKeyDown(KeyCode.S))
        {
            foreach (Transform child in transform)
            {
                GameObject enemy = Instantiate(EnemyPrefab, child.transform.position, Quaternion.identity) as GameObject;
                enemy.transform.parent = child;
            }
        }
    }
}

So the problem is what it says. There is no Camera component attached to your EnemySpawner GameObject. If you want to reference your player’s camera in that line, then you should change line 16. to:

Camera camera = GameObject.Find("yourPlayer'sName").GetComponent<Camera>();