For example, if player A killed player B, how can I make it so player A gets a specific item using commands? ~~~{if you killed A player you will get diamond,if you kill B player you will get emerald for example

I tried these commands but it gives all player the same item + I want a specific player is killed

Commands: To get a command block -

/give USERNAME minecraft:command_block

To create the first scoreboard -

/scoreboard objectives add Kills playerKillCount

To create the second scoreboard -

/scoreboard objectives add Count playerKillCount

To add the first scoreboard to the side bar -

/scoreboard objectives setdisplay sidebar Kills

First command block: For diamonds -

/give @p[scores={Count=1..]} minecraft:diamond 1

For emeralds -

/give @p[scores={Count=1..]} minecraft:emerald 1

For XP -

/xp add @p[scores={Count=1..]} 1 levels

Second command block:

/scoreboard players reset @p[Scores={Count=1..]} Count

To clear kill sidebar:

/scoreboard players reset @a Kills
  • We can't help you unless you've at least tried to help yourself—have you tried looking for solutions but didn't find anything? Please share what you found and why it didn't do what you wanted. You also need to add a tag to your question to specify what version you're playing, either minecraft-java-edition, minecraft-bedrock-edition, or one of the other MC edition tags. Commands are very different when you switch editions, so please edit your question to include your Minecraft edition and what research you've done. Jan 2, 2021 at 20:48
  • thx for your help + I edited the question Jan 3, 2021 at 8:42
  • 1
    Can you use a data pack? Jan 3, 2021 at 20:59
  • I answered a similar question it might help you: gaming.stackexchange.com/questions/380860/… Mar 19, 2021 at 2:48


You must log in to answer this question.

Browse other questions tagged .