Attaching camera to prefab

Hello, I’m new to networking. I already have a game that I’m trying to convert to multiplayer. Instead of already having the character in the scene, I’m instantiating it. The problem is I don’t know how to connect the camera to follow the character. I made its “Target” the character and then set up the character as a prefab and instantiated it, but the camera just goes to where the character object was and stays there.

Any help would be appreciated.

On the main camera:

function SetTarget(target : Transform)
{
    if (target != null)
    {
        transform.position = target.position;
        transform.rotation = target.rotation;
    }

    transform.parent = target;
}

On the player character:

var cameraTarget : Transform;

function Start()
{
    if (networkView.isMine)
        Camera.main.SendMessage("SetTarget", cameraTarget);
}

Hi YosemiteSam, I’ve just tested it, because I have the same problem, but it returns an error:

SendMessage SetTarget has no receiver!
UnityEngine.Component:SendMessage(String, Object)
Move:Update() (at Assets/Scripts/Move.cs:27)

What could be wrong?