Hi, so this has been drilling on me for a day now and i tried two different commands but neither worked.
The aim of what im trying to do is run a command when a scoreboard changed ie- when someone dies (which enters the score board), a command runs when the score changes/goes up.
These are the two commands I have tried so far
execute if score USER Deaths > 1 Deaths run say test
execute as @a[scores={Deaths=1..}] run say test
I feel like the second one would be more correct but yeah, the second one isnt working so if you can pick out what im doing wrong please say thank you <3
The Meaning of Life, the Universe, and Everything.
Location:
Stockholm
Join Date:
3/27/2016
Posts:
14
Minecraft:
LouisLuigi38
Discord:
LouisLuigi#8501
Member Details
So if I understand correctly, your goal here is to detect whenever a player dies.
The problem being that you can't detect when a score changes naturally, you have to cheat a little.
I have found a way to do that by using the health system of a player.
Here is a system that seems to be working :
execute as @a[scores={life=0},tag=!just_died] run <your_command>
execute as @a[scores={life=0},tag=!just_died] run tag @s add just_died
execute as @a[scores={life=1..},tag=just_died] run tag @s remove just_died
The first command will allow you to execute <your_command> whenever a player dies.
The second one will add a custom tag to that player to force the first command to run only once.
The third and final command will remove the custom tag when the player respawns.
Still doesn't seem do be working. I put them in seperate command blocks and made them all facing each other so i dont know if it is me being absolutely ditzy or do i need to create a function for this?
The Meaning of Life, the Universe, and Everything.
Location:
Stockholm
Join Date:
3/27/2016
Posts:
14
Minecraft:
LouisLuigi38
Discord:
LouisLuigi#8501
Member Details
Oh yeah I didn't specify that, sorry. You are supposed to chain the command blocks together. Put the first command into a repeating command block. Then, put the next two commands in chain command blocks.
I have attached an image of what is supposed to look like.
Don't forget to set all three to Always Active.
Whenever you die, <your_command> should be executed.
You could also go for a function if you prefer.
Woops, my bad. The image I included has the last command block set to conditional. This is a mistake, please disable conditional mode for all of them.
Hi, so this has been drilling on me for a day now and i tried two different commands but neither worked.
The aim of what im trying to do is run a command when a scoreboard changed ie- when someone dies (which enters the score board), a command runs when the score changes/goes up.
These are the two commands I have tried so far
execute if score USER Deaths > 1 Deaths run say test
execute as @a[scores={Deaths=1..}] run say test
I feel like the second one would be more correct but yeah, the second one isnt working so if you can pick out what im doing wrong please say thank you <3
So if I understand correctly, your goal here is to detect whenever a player dies.
The problem being that you can't detect when a score changes naturally, you have to cheat a little.
I have found a way to do that by using the health system of a player.
Here is a system that seems to be working :
The first command will allow you to execute <your_command> whenever a player dies.
The second one will add a custom tag to that player to force the first command to run only once.
The third and final command will remove the custom tag when the player respawns.
Hope that helps!
Still doesn't seem do be working. I put them in seperate command blocks and made them all facing each other so i dont know if it is me being absolutely ditzy or do i need to create a function for this?
Oh yeah I didn't specify that, sorry. You are supposed to chain the command blocks together. Put the first command into a repeating command block. Then, put the next two commands in chain command blocks.
I have attached an image of what is supposed to look like.
Don't forget to set all three to Always Active.
Whenever you die, <your_command> should be executed.
You could also go for a function if you prefer.
Woops, my bad. The image I included has the last command block set to conditional. This is a mistake, please disable conditional mode for all of them.