synch spawned objects

hello guys i have i have a projectile, when a player spawns it, it is moved by the networkbehavior attached to it
it works on the hostside, the problem is on the client it doesn’t the projectile just travels downwards n not towards the hit.point, lemme show you the codes

[ServerRpc(RequireOwnership = false)]
    public void ShowTrailServerRpc(Vector3 startPos, Vector3 hitpoint)
    {
        StartCoroutine(ShowTrail(startPos, hitpoint));
    }
    public IEnumerator ShowTrail(Vector3 startPos, Vector3 hitpoint)
    {
        yield return new WaitUntil(() => startPos != Vector3.zero);
        float time = 0;
        while (time < 1)
        {
            transform.position = Vector3.Lerp(startPos, hitpoint, time);
            time += Time.deltaTime / trail.time;
            yield return null;
        }
        //hit effect;
    }    
// I have this code in a networkbehavior attached to a bullet, and is called when the player //spawns it

and the code the player uses to spawn this projectile

void Update()
    {
        if (!IsOwner) return;
        Rotate();
        if (Physics.Raycast(playerCam.position, playerCam.forward, out hit, 1000, ~layerMask))
        {
            Debug.DrawLine(playerCam.position, hit.point, OwnerClientId == 1 ? Color.red : Color.green);
        }
        if (Input.GetKeyDown(KeyCode.Mouse0))
        {
            if (Physics.Raycast(playerCam.position, playerCam.forward, out hit, 1000, ~layerMask))
            {
                dirToShoot = (hit.point - transform.position).normalized;
                ProjectileServerRpc(dirToShoot);
                print(hit.transform);
            }
        }
    }
    [ServerRpc(RequireOwnership = false)]
    void ProjectileServerRpc(Vector3 direction)
    {
        Projectile2(direction);
    }
    void Projectile2(Vector3 direction)
    {
        GameObject go = Instantiate(prefab, startpos.position, startpos.rotation);
        go.GetComponent<NetworkObject>().Spawn();
        go.GetComponent<TestProjectile>().ShowTrailServerRpc(startpos.position, hit.point);
    }

You start the taril corutine only on the server. Shouldn’t this be client rpc like:

[ClientRPC]
    public void ShowTrailClientRpc(Vector3 startPos, Vector3 hitpoint)
    {
        StartCoroutine(ShowTrail(startPos, hitpoint));
    }
    public IEnumerator ShowTrail(Vector3 startPos, Vector3 hitpoint)
    {
        yield return new WaitUntil(() => startPos != Vector3.zero);
        float time = 0;
        while (time < 1)
        {
            transform.position = Vector3.Lerp(startPos, hitpoint, time);
            time += Time.deltaTime / trail.time;
            yield return null;
        }
        //hit effect;
    }

i tried calling the clientrpc too instead of serverrpc from the player’s script it behaved the same way, still just working on the server,

Do you have netwrok transform on the bullet? It will make the position sync between the client and the server. Or you can create a bullet in the clientRPC and move it localy.

i found the solution using networkobject refrence