Command Blocks In Minercaft Giving items On Kills
Could I make it so that when I kill a player for the first time, a command block gives me an iron sword, on my second kill it gives me a diamond sword, on my third kill it gives me an enchanted item, and so on?
I also want a way to reset this, as well as a start button. I know a way that I can do this by doing /scoreboard objectives add objectivename playerKillCount, and then a comparator does /give @p iron_sword. However, if I am too far from the command block and another player is next to it, the command block will give the sword to them instead. Also, @p won't work for the whole world, because I have to be near it. Can somebody please help me with a way that I can do this?
Pictures about "Command Blocks In Minercaft Giving items On Kills"



How do you get items when you kill someone in Minecraft?
ExamplesHow do you kill things with command blocks?
You can give a player any item whenever you want using the /give command in Minecraft.What is the command to give a player items in Minecraft?
One of the most popular and fastest ways to clear items is the kill command. First, type /kill @e[type=item] in the chat and press enter to remove all dropped items in your Minecraft world instantly. However, you will need to have operator status and enable cheats in your world for this command to work.Minecraft 1.16 Kill Reward System // Command Block Tutorial
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Sharon McCutcheon, Samson Katt, Leon Natan, billow926
