Can scoreboards detect if a player is killed with a specific item?

[BACK]
Can scoreboards detect if a player is killed with a specific item?
Posted On: March 14, 2024

I'm making a sword that will gain attack damage every time a player gets a kill with it. I think I can get the sword attributes to change based on a scoreboard, but I don't know if I can make a scoreboard that detects if a player is killed by someone using the sword. Does anyone know if this is possible, and if so, how would I do it?


Question from user VeryHotClara at gaming.stackexchange.com.


Answer:

Give yourself an item, for example a sword, include this nbt:.


{customid:"leveling_sword",AttributeModifiers:[{AttributeName:"generic.attack_damage",Name:"generic.attack_damage",Amount:1,Operation:0,UUID:[I;1634486241,408504796,-1808684184,1791120101],Slot:"mainhand"}]}.


It doesn't matter what the UUID is because we will use a custom NBT tag.


Setup commands (run once):.


`/scoreboard objectives add kill playerKillCount kill```\.


For the looped commands you either put them in this order using 1 repeating and multiple chain command blocks, or just use a function in a datapack.


Looped commands:.


/execute as @a[scores={kill=1..},nbt={SelectedItem:{customid:"leveling_sword"}}] run .


/scoreboard players set @a kill 0.


For the part I'm not sure on the exact stuff to do. I know 2 options but I don't have time rn so imma just post this and someone else might have a better idea.


Option one is to replace the first command with /item:.


item modify @a[scores={kill=1..},nbt={SelectedItem:{customid:"leveling_sword"}}] where points to a json file in a loaded datapack.


https://minecraft.wiki/w/Item_modifier.


Option two is to use /data using NBT path format which doesn't require a datapack. However you can't use /data on a player so you first have to move the item to another entity like an armor stand. You might need one armor stand per player in case there are 2 kills on the same game tick. A possibility is to put a marker armor stand on each player's head using /ride.


Answer from user Samstercraft at gaming.stackexchange.com.


[BACK]
Can scoreboards detect if a player is killed with a specific item?
Posted On: March 14, 2024

I'm making a sword that will gain attack damage every time a player gets a kill with it. I think I can get the sword attributes to change based on a scoreboard, but I don't know if I can make a scoreboard that detects if a player is killed by someone using the sword. Does anyone know if this is possible, and if so, how would I do it?


Question from user VeryHotClara at gaming.stackexchange.com.


Answer:

Give yourself an item, for example a sword, include this nbt:.


{customid:"leveling_sword",AttributeModifiers:[{AttributeName:"generic.attack_damage",Name:"generic.attack_damage",Amount:1,Operation:0,UUID:[I;1634486241,408504796,-1808684184,1791120101],Slot:"mainhand"}]}.


It doesn't matter what the UUID is because we will use a custom NBT tag.


Setup commands (run once):.


`/scoreboard objectives add kill playerKillCount kill```\.


For the looped commands you either put them in this order using 1 repeating and multiple chain command blocks, or just use a function in a datapack.


Looped commands:.


/execute as @a[scores={kill=1..},nbt={SelectedItem:{customid:"leveling_sword"}}] run .


/scoreboard players set @a kill 0.


For the part I'm not sure on the exact stuff to do. I know 2 options but I don't have time rn so imma just post this and someone else might have a better idea.


Option one is to replace the first command with /item:.


item modify @a[scores={kill=1..},nbt={SelectedItem:{customid:"leveling_sword"}}] where points to a json file in a loaded datapack.


https://minecraft.wiki/w/Item_modifier.


Option two is to use /data using NBT path format which doesn't require a datapack. However you can't use /data on a player so you first have to move the item to another entity like an armor stand. You might need one armor stand per player in case there are 2 kills on the same game tick. A possibility is to put a marker armor stand on each player's head using /ride.


Answer from user Samstercraft at gaming.stackexchange.com.


[BACK]

How can you be immune to damage from bed explosions in the nether? How can you be immune to damage from bed explosions in the nether?

Posted On: April 11, 2023
In Minecraft, everyone seems to able to use beds for mining or killing the Ender Dragon, but whenever I use it I blow up instantly. Is this a bug, or how can I be immune to this damage? Question...[More]


What's the Path of Least Resistance for Honor Mode? What's the Path of Least Resistance for Honor Mode?

Posted On: November 11, 2025
I really wanna get it done, I know the basics, talk down Lump and the goblins in the village, wander around and get Karlach, free Slazza, what's everything that you should be doing to get high enough ...[More]


In Beat Saber how do I disable TinyTAN avatars on BTS songs? In Beat Saber how do I disable TinyTAN avatars on BTS songs?

Posted On: March 3, 2023
Sometimes while playing Beat Saber's BTS Music Pack, TinyTAN avatars will appear mid-song and start flying around. The extra distraction makes it difficult to play Expert or Expert+ tracks. Is ...[More]


How can you run Skyrim in borderless window mode? How can you run Skyrim in borderless window mode?

Posted On: April 6, 2023
I've noticed Skyrim has some issues when minimizing. This is a real pain when playing on multiple monitors and you attempt to find something on the other monitor. Is there anyway to enable borderl...[More]


What is the health bar in Halo games? What is the health bar in Halo games?

Posted On: June 17, 2023
In most Halo games, there's usually a "shield capacity bar" which depletes with damage. When this bar is fully depleted, there's a secondary bar that starts to deplete. What is this ...[More]


How do I play VALORANT on a non-Intel, Apple silicon, macOS computer? How do I play VALORANT on a non-Intel, Apple silicon, macOS computer?

Posted On: March 28, 2024
VALORANT, currently, is not on MacOS. It is also not on Steam. You cannot download VALORANT through the website because. Well, there's no button to do so. So how do you get it on Mac?Originally, I tho...[More]


Is there a way to share vision with opponent in Starcraft 2? Is there a way to share vision with opponent in Starcraft 2?

Posted On: June 25, 2023
There are times that I would like to be able to share vision with my opponents when playing Starcraft 2. This was possible in the original Starcraft, but I can't find a way in Starcraft 2. Situ...[More]


Maximizing unarmed damage in skyrim Maximizing unarmed damage in skyrim

Posted On: February 15, 2023
It's been nearly a decade since this was asked, and by now it's hard to find an installation of Skyrim without at least the DLCs. There's no guarantee that Khajit are the strongest unarmed...[More]


Should I reset Should I reset

Posted On: October 7, 2025
I’ve recently beaten kethric thorm and no have the problem of my level is too low and there is simply not enough creatures to fight to raise it to a spot where the difficulty is fair and fun.I’m l...[More]


I don't like Gale I don't like Gale

Posted On: April 7, 2026
I know I'm not alone in this opinion either, but there's also a shocking amount of people who love Gale so I'm trying to understand the appeal. .Please understand, I have used Gale in my party all the...[More]