How do I set a target gameobject within another gameobjects component?

Hi, I have this existing code for the other things I need to happen:

void OnMouseDown() {
GameObject.Find("Player_ShotgunDude").GetComponent<PlayerMovement>().enabled=true;

GameObject.Find("Main Camera").transform.position = new Vector3(0, 20, 0); 

GameObject.Find("Main Camera").GetComponent<CameraFollow>().enabled=true;
	}

I want to add another piece to my OnMouseDown that finds the main camera and its CameraFollow script and changes the target of that script to whatever other gameobject I specified at the time.

I tried looking to see if there was any set target stuff but didnt find anything. Any help would be appreciated.

Cheers.

GameObject target;

void OnMouseDown ()
{
    Camera.main.GetComponent<CameraFollow>().target = target;
}

Does that not work? It’s hard for us to write exactly what would work in your scenario without knowing the other script/elements of your scene.