how do you send commands from objects that dont have "Authortiy" unet

I made a rocket launcher that uses projectiles rather than raycast since raycast is instant etc

but when I try to send values of damage to the main player again it always gives me the warning doesnt have authority heres idk if their is a correct way of doing this and if so let me know

// on player object with authority
public void SendDamge(string name, float Splashdamage) {

        CmdPlayerShot(name, Splashdamage);


    }

    

    [Command]
    public void CmdPlayerShot(string _playerID, float _damage)
    {

        UnityEngine.Debug.Log(_playerID + " has been shot");
        Player _player = GameManager1.GetPlayer(_playerID);
        _player.RpcTakeDamage(_damage);

        
    }

// on rocket without authority projectile that is instantiated from the player

public class RocketProj : Rocket 
{


    public bool hitPlayer;
    private Vector3 midScreen;

    private void OnCollisionEnter(Collision collision)
    {

        Debug.Log("test");
        var tempexpEffect = Instantiate(explosionEffect, this.transform.position, this.transform.rotation);
        Destroy(tempexpEffect, 1);

        if (collision.collider.tag == "Player")
        {

            hitPlayer = true;

        }
        else hitPlayer = false;
            

            
        //Destroy(this.gameObject);
    }

    public void hitPlayerCalcSplash(RaycastHit _hitInfo)
    {
        if (hitPlayer == true) { 
        Debug.Log(_hitInfo.collider.name);
        hitColliders = Physics.OverlapSphere(_hitInfo.point, splashRadius);
        int i = 0;
            while (i < hitColliders.Length)
            {
                if (hitColliders*.tag == "Player")*

{

proximity = (_hitInfo.point - _hitInfo.collider.transform.position).magnitude;
Splashdamage = CritHitDamage - (proximity / splashRadius);
UnityEngine.Debug.Log(“Rocket Splash hit a player”);
// SendDamge(hitColliders*.name, Splashdamage);*
Destroy(this.gameObject);

}

} i++;
}
}
}

You can’t send commands to objects you don’t have authority over. Your main communication object is your player object. So the usual eventflow is:

  • Your client receives user input
  • You send a command through your playerobject to the server
  • On the serverside of your playerobject the server may perform any server-side actions like spawning objects or sending client RPCs back to the clients.

You have to design your playerobject and your command methods in a way so you can communicate whatever the client may want to affect on the server / game. Most of the logic should happen on the serverside. So a client may just send a command to the server to launch a rocket. The server will instantiate and spawn the rocket. Any hit-detection of the rocket will happen on the server only. The rocket is usually owned by the server. On hit the server will decide about health reduction and any other actions that follow the impact. Of course the rocket need to have a network identity like any prefab that should be spawned for all peers.