1.8 and later
/scoreboard players reset
removes a player's score in a specified objective completely, making it so that the player doesn't show up in the sidebar display slot.
First, set up a kill counter objective
/scoreboard objectives add killCounter playerKillCount Kills
Set up a 20 Hz. clock (or use 1.9's repeat/chain command blocks) and have it run:
/scoreboard players reset @a[name=!<player>]
where <player>
is replaced by the player's name. If you want to track more than one player's kills, you have to figure how to target all players whose kills you don't want to track. Most of the time, you should already know how to select these players based on how they were selected to be shown in the first place. If not, a simple way to do this is to use the scoreboard tags introduced in 1.9:
/scoreboard players tag <player> add trackKills
where <player>
is replaced by the player's name or a valid target selector. Run this once for every player to be tracked, then use @a[tag=!trackKills]
in the scoreboard reset command above.
1.7
Without reset
, we'll need two objectives. One to track all players' player kills, and one to store kills for certain players:
/scoreboard objectives add killCounter playerKillCount
/scoreboard objectives add selectKillCount dummy Kills
Set up a 20 Hz. clock and have it run these commands in order:
/scoreboard players add @a[name=<player>,score_killCounter_min=1] selectKillCount 1
/scoreboard players set @a killCounter 0
Replace <player>
with the name of the player to track. When tracking more than one player, you'll have to assign them some score in another dummy objective and use that in the target selector instead of name
.
The activation order does matter and is what's causing the problem. However, activation order via redstone dust does not follow a pattern nor is the order it activates guaranteed to be constant. You would be better off adding delay between the two commands or using a more reliable activation method such as a /fill
clock.
Image example of activation order from a /fill
clock:
Source & tutorial
In 1.9, you can simply use chained command blocks to directly specify the order commands are activated, so as to not rely on unreliable and directional methods.
Best Answer
By using the
minecraft.killed:minecraft.player
you can track whenever any player kills a player, if you would combine this with adeathCount
on the specific player and test for both scores you can add adummy
score to display kills:Scoreboards, I used the name
kill
for when someone has killed a player:I used the name
Death
for the specific player'sdeathCount
score:I used the name
Kills
for the displayed kills:Remember to set scores to
0
to each player:I used the name
Player
for the specific player.To test for when a player has a kill score of 1 and the specific player has a death count of 1, you can do with this command:
Because the specific player can only be killed by one player, only one player will get a point for the
kill
score. The command tests for the specific player's death count and any player with a kill, it then gives that player a point in thedummy
scoreKills
.But you need to reset this as well, you then need to place the last command in a repeating command block and place two chain command blocks after it with these commands:
This command will reset the kill counter for any player with a score of 1, this will reset even if the specific player is alive, so the
Kills
score will not change.Next command:
This will reset the special player's death counter.
The reason these two last commands is in a chain after the first execute command is so that they run within the same tick but the first one runs first so that the scores don't reset before a point can be added to the
Kills
score.