Change Target from Script in GameObject with another Script

Hello,
I create a SolarSystem Simulation and I want if I click on the Text over the Planet switch to the Planet. I have a script for zoom around the Sun. In this Script is a target for the orbiting for the camera and I don’t know how to change the target to the Planet (GameObject)

I need a code to change the target from a script in a other script.

My idea:

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

public class ClickMercury : MonoBehaviour
{
  
    void Update() {
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit))
        {
            if (hit.transform.name == "MercuryText")
            {
// Here is the Problem
                GameObject.Find(MainCamera).GetComponent<ZoomCamera>().target = gameObject;
            }
            else
            {
               
            }
        }
    }
}

Thanks for help!

GameObject.Find(MainCamera).GetComponent().target = gameObject; The gameObject in this line refers to the gameObject the script is on. You want the gameObject detected by the ray. hit.gameObject. using transform and gameObject is like using the this keyword, it references the object the script is attached to.