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]

In Hogwarts is it possible to change audio language? In Hogwarts is it possible to change audio language?

Posted On: February 10, 2023
I am playing the Japanese version of Hogwarts Legacy on PC (Steam). The store page says that Hogwarts Legacy has Full Audio support for 8 languages, including Japanese. But, for immersion, I want t...[More]


What are these Minecraft red lasers? What are these Minecraft red lasers?

Posted On: July 8, 2023
These just appeared. What's going on?!. They seem to follow me around, but appear patchily. What have I done? Question from user fredley at stackexchange. Answer: They are marking loca...[More]


Best Hogwarts Legacy Magic Combo Button Layouts Best Hogwarts Legacy Magic Combo Button Layouts

Posted On: June 6, 2023
Just picked up the game on PS5 and loving it. But I’m wondering what people think are the best combos to set up for their magic. I’m about 35% of the way through the game so I have a fair ...[More]


Can guards find and arrest you in casing mode in a public area during a searching phase? Can guards find and arrest you in casing mode in a public area during a searching phase?

Posted On: September 10, 2023
In Payday 3, certain things can cause a Searching phase, such as a teammate being cuffed. During this phase, if you're caught in a private area in casing mode you will be cuffed instead of escorte...[More]


Not even a scrying eye yelling for help could move her Not even a scrying eye yelling for help could move her

Posted On: January 27, 2026
I legit must of killed like 20 npcs in that tiny room right next to her and she never even budged. The entire time there was a scrying eye alive doing its thing.Question from user RyanCreamer202 at Ba...[More]


Where can I contact roblox support (a real person)? Where can I contact roblox support (a real person)?

Posted On: September 19, 2023
Can someone tell me how to contact Roblox support? I don't mean roblox/support, that's just a bot. I want to talk to a real human who works in Roblox support. Question from user comand100vi...[More]


Would the companion talk to each other about Tav - Durge? Would the companion talk to each other about Tav - Durge?

Posted On: November 8, 2023
Specifically if you manage to romance nearly all of them, do they just sit around the campfire and talk to each other about it, like it's the Bachelor/Bachelorette - Faerun edition? Or do they ...[More]


Can a War Caster use Shocking Gasp as a reaction without having it as a Cantrip? Can a War Caster use Shocking Gasp as a reaction without having it as a Cantrip?

Posted On: October 22, 2023
When leveling up my character, I have the option to take the War Caster feat which says I can use a reaction to cast Shocking Grasp at a target moving out of melee range. However, my character does no...[More]


Can you cast a Patronus Charm in Hogwarts Legacy? Can you cast a Patronus Charm in Hogwarts Legacy?

Posted On: July 19, 2023
Is it possible to use the Patronus Charm in Hogwarts Legacy? If yes, then where and how? Question from user Shaun Roselt at stackexchange. Answer: No. According to an article on videogamer...[More]


In Elder Scrolls, What happens if I kill Imperial guards? In Elder Scrolls, What happens if I kill Imperial guards?

Posted On: April 23, 2023
On the way to Whiterun from Riverwood, I rescued a Stormcloak prisoner from some Imperial guards. The Stormcloak guy didn't even say much of a thanks (although I did choose the option to free him)...[More]