I need help with unity navigation networking

Hello guys I need help with a C# script that is the Goto Mouse script for navigation but I can not get it working in Multiplayer. Please help.

using UnityEngine;
using UnityEngine.Networking;

public class Movetopoint : NetworkBehaviour
{
    NavMeshAgent agent;
    public GameObject cam;
    void Start()
    {
        agent = GetComponent<NavMeshAgent>();
    }

    void Update()
    {
        if (!isLocalPlayer)
        {
            return;
        }
            if (Input.GetMouseButtonDown(0))
            {
                RaycastHit hit;

                if (Physics.Raycast(Camera.current.ScreenPointToRay(Input.mousePosition), out hit, 100))
                {
                Debug.Log("Hit");
                    agent.destination = hit.point;
                }
            }
        
    }
}

You need to add NetworkIdentity and NetworkTransform components on the gameobject to network its position.