Unet: [Command] not running

I have this code:

using UnityEngine;
using UnityEngine.Networking;
using System.Collections;

public class ChatPlayer : NetworkBehaviour {

	// Use this for initialization
	void Start () {
		
	}
	
	// Update is called once per frame
	void Update () {
		if (Input.GetKeyDown (KeyCode.Q))
			CmdHello ();
	}

	[Command]
	void CmdHello(){
		print ("Hello!");
	}
}

This script is in a player spawn prefab, and as you can see, if you press q, the client sends a command to print hello in its console. When I do press q, the server, nor client gets a message saying “Hello!”.

I had an inactive GameObject which was a copy of the prefab. I put my script there, instead of the actual prefab. :frowning: