Camera Editor,Camera Editor

Hi.
I’m trying to make a camera Editor that can assign the camera to the player and the player to the camera as a target by selecting them in menu and clicking on the create the new camera Button, but my code right now assigns the camera to the player a target and give the camera script to the player. I can’t find out what I’m doing wrong, can someone please read my code to see what I’m doing wrong?
btw I’m making the selection right on the menu.
this is the code:

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

namespace Rook.Cameras
{
public class CameraMenu : MonoBehaviour
{
[MenuItem(“Rook/Cameras/Top Down Camera”)]
public static void CreateTopDownCamera()
{
GameObject selectedGo = Selection.gameObjects;

        if(selectedGo.Length > 0 || selectedGo[0].GetComponent<Camera>())
        {
            if(selectedGo.Length < 2)
            {
                AttachTopDownScript(selectedGo[0].gameObject, null);
            }
            else if(selectedGo.Length == 2)
            {
                AttachTopDownScript(selectedGo[0].gameObject, selectedGo[1].transform);
            }
            else if(selectedGo.Length == 3)
            {
                EditorUtility.DisplayDialog("Camera Tool", "You can only select two GameObjects in the scene for this to work and first selection needs to be a Camera!", "OK");
            }
        }
        else
        {
            EditorUtility.DisplayDialog("Camera Tool", "Please Select a Gameobject in the scene that has a Camera component in it!", "OK");
        }
    }
    static void AttachTopDownScript(GameObject aCamera, Transform aTarget)
    {
        TopDownCamera cameraScript = null;
        if (aCamera)
        {
            cameraScript = aCamera.AddComponent<TopDownCamera>();
        
        if(cameraScript || aTarget)
        {
            cameraScript.target = aTarget;
        }

        Selection.activeGameObject = aCamera;
        }
    }
}

}

if you needed a better look at the code