Destroying gameobjects on clients and host

Hi!
Really all i want to do is to destroy a gameobject on both the host and clients. You can use

Network.Destroy(GetComponent().viewID);
or
Network.Destroy(gameObject);

to achieve this, but this only works when you execute it on the host, if you execute it on the clients it will only destroy the object locally. I know that the clients can not destroy gameobjects, their supposed to request the host or server to do so, can somebody explain how to do this in detail? I have had really hard to find information about any of this, so if somebody could clear it up it would be really helpful.
//Benjamin

Have a look at this Manual Section:
https://docs.unity3d.com/Manual/UNetActions.html

What you need are commands:

Commands are sent from player objects on the client to player objects on the server.

You should always destroy objects on the node that created it. If you create an object on the server, you should destroy it there, if you destroy it on the client, the same.

The easiest way to keep track of this is:
All game objects that are synched through the network should be created and destroyed on the server only (this is called an authorative server). This will make the implementation easier as well as make cheating more difficult.

All objects that are only kept locally (effects or bullets, etc.) should be created and destroyed on the client, but not via the network, dont use Network.Destroy.

Generally, it is easy to lose track of where is which code executed. Try to make it as obvious as possible!

You have to keep two things in mind.

  1. Use Commands to sync things between all the players in the game (in your case, if you delete a game object through the command, It gets deleted on the server and then syncs it with the clients, i.e it deletes it on clients as well)
  2. Also remember to check the authority if it is a non-player object (i.e which player owns the object).

Either way yo have to use command function to execute it on the server and replicate it on the clients.

Ok, i wrote this code:

using UnityEngine;
using UnityEngine.Networking;

public class ShootableBox : NetworkBehaviour
{
    public int currentHealth =  1;
    public GameObject fire;          

    public void Damage(int damageAmount)
    {
        currentHealth -= damageAmount;

        if(currentHealth <= 0)
        {
            CmdDestroy();            
        }
    }

    [Command]
    void CmdDestroy()
    {
        Network.Destroy(gameObject);
    }
}

It works perfectly on the host side just like before, but when i do it on the client absolutely nothing happens. Is there something i have written wrong?

Ok, i wrote this code:

using UnityEngine;
using UnityEngine.Networking;

public class ShootableBox : NetworkBehaviour
{
    public int currentHealth =  1;
    public GameObject fire;          

    public void Damage(int damageAmount)
    {
        currentHealth -= damageAmount;

        if(currentHealth <= 0)
        {
            CmdDestroy();            
        }
    }

    [Command]
    void CmdDestroy()
    {
        Network.Destroy(gameObject);
    }
}

It works perfectly on the host side just like before, but when i do it on the client absolutely nothing happens. Is there something i have written wrong?

I think you just need to call Destroy (this.gameObject) in CmdDestroy function. This runs on the server anyway and should update all the clients.