Camera to spawn with GameObject

Hello, Im new to Java and have been stuck on a problem. Currently I spawn a square in a Network and can move it around. Now i am trying to add a camera to follow the cube when it spawns. Any help would be appreciated!

    var playerPrefab:GameObject;
    var spawnObject:Transform;
    
    function spawnPlayer(){
	Network.Instantiate(playerPrefab, spawnObject.position, Quaternion.identity, 0)
}

function OnServerInitialized(){
	Debug.Log("Server Initialized");
	spawnPlayer();

}

You have to assign camera follow script to you network game object.
For camera access you don’t have to do any thing special only

Camera.main.gameObject work for you.

If you have any other question then ask it with proper detail.

function spawnPlayer(){
GameObject tempObj= Network.Instantiate(playerPrefab, spawnObject.position, Quaternion.identity, 0);

tempObj.AddComponent<CameraFollowScript>();
}

This will add CameraFollowScript to you player.