Send data to specific players/clients with mirror.

Hello everyone, I am following a mirror room creation guide in which you create instances for each game with an identifier per instance. I find the problem when I send commands within the instances because the server sends it to all the players. Looking at Attributes | Mirror I know that it’s more or less possible but I’ve been quite confused for a couple of days about the best method to be able to send messages only to players with the identifier of the instance. Does anyone know what is the best way to do it? I was previously using photon and am pretty new with mirror. Thank you!

You’re looking for TargetRpc.

Hello Punfish!, thanks for answering. I have been researching about the TargetRpc, but I think that for what I need I don’t know if they are valid. The message that I want only certain clients to see is the spawn of the player, so I think I am forced to do it through [Command].
When entering the server, the playerPrefab only has a NetworkIdentity and the script in charge of managing rooms. When entering the first Scene, depending on the game mode, I spawn a type of playerprefab. So I don’t know if I’m right that the condition for the second playersPrefab to be visible must be in the [Command] or in a TargetRpc.

Basically the code is now like this:

[Command]
void CmdTest()
{
GameObject playerPref = Instantiate(normalPlayer);

NetworkServer.Spawn(playerPref, connectionToClient);
TargetDoMagic(playerPref);

}
[TargetRpc]
public void TargetDoMagic(GameObject playerPref)
{

copyPlayer = playerPref; //this is to enable some things in the Spawned playerprfab
}

on the other hand there is the string MatchID; which differentiates the room in which each player is.