Command block quandary

I'm making a 2 player adventure map. Throughout the map there are places where both players will enter at the same time. The question I have is this: is there a way to have a command block say something to both players that only they can see (like a secret that the other one can't see)

This is going to be a big part of the game as it's a team work/PvP mystery game, so any help would be much appreciated


Solution 1:

Yes! There are two ways:

You can either /tellraw or you could /msg. Syntax:

/tellraw [selector] [json string]
/msg [selector] [message]

Both have arguments that allow you to specify who to send said message to.
Just have them filterable in some way, for example: Assigning teams.

Alternatively, this really complicated and botched method also works (though I wouldn't recommend it, at all, because you would need one set per concurrent player and does not support people switching in/out).


/scoreboard objectives add PlayerID PlayerID dummy
<insert my linked crude contraption>
/tellraw @a[score_PlayerID_min=0,score_PlayerID=0] {text:"You are player 0"}
/msg @a[score_PlayerID_min=1,score_PlayerID=1] You are player 1.