Spawning players for both client and host

The host can place an object and the client can see it but the client places an object the host cant see it
i know im doing this wrong but what would i need to do to make it both show up for both players and both can spawn an object
ally is my object btw

if (Input.GetButtonDown("Fire1") && _enabled == true)
        {
            if (data.food >= 1)
            {
                data.food -= 100;
                if (Physics.Raycast(ray, out hitInfo))
                {
                    
                    CmdOnSpawn();
                    
                }
            }
        }
    }
    [Command]
    private void CmdOnSpawn()
    {
        RpcOnSpawn();
    }

    
    [ClientRpc]
    private void RpcOnSpawn()
    {
        var ally = Instantiate(allyObj, hitInfo.point, Quaternion.identity);
        NetworkServer.Spawn(ally);
        
    }
}

You dont have to call a ClientRpc, because Networkserver.Spawn must only called on the host-pc.
Try this:

[Command]
 private void CmdOnSpawn(Vector3 position, Quaternion rotation)
 {
              GameObject ally = Instantiate(allyObj, position, rotation);
              NetworkServer.Spawn(ally);
 }

Make sure that the “allyObj”-prefab is registered in the inspector of the NetworkManager in the “SpawnInfo” section :stuck_out_tongue: