1

I am trying to make command blocks kick me when I die on a multiplayer server I own, running 1.17.1, I have been trying to figure this out for an hour now and still have not gotten this to work.

before posting this question I have tried adding myself to a team then checking if that team has died using execute at @a[team=ryan,scores={deaths=1..}] in a repeat command block.

I then had that command block run into a chain command block containing the command scoreboard players reset @a[team=ryan,scores={deaths=0..}] deaths using this to reset the deathCount score back to 0.

This command then ran into a impulse command block containing kick (playername)

I will put some images of the command blocks in case I have a typo and to give a better understanding of what I am doing.

Command blocks on ground : enter image description here

1st repeating command block : enter image description here

2nd chain command block : enter image description here

3rd impulse command block : enter image description here

2
  • 1
    Kick or ban? Because if you mean kick they can just rejoin after a death.
    – Mike Z.
    Commented Aug 10, 2021 at 1:45
  • 1
    Looks like you have posted this question elsewhere and received an answer. Would you mind creating an answer post detailing how you solved the problem, then accepting it? This will mark the question as solved.
    – One 2 Many
    Commented Aug 10, 2021 at 4:52

1 Answer 1

1

First, you need to make sure you have added the score you test for.

This will be the command to add the score of name deaths that tests for how many times a player has died:

/scoreboard objectives add deaths deathCount

Then, you need to replace the at in the first command with if entity:

execute if entity @a[scores={deaths=1..}]

Then it needs to go into a chain command block that is set to Conditional:

Chain command block

The next command will be:

execute as @a[scores={deaths=1..}] run kick @s

Here you need to make sure that you use as so you can use @s later in the command.

The last command block needs to be the same as the 2nd and have this command:

scoreboard players set @a[scores={deaths=1..}] deaths 0


Note

This will kick any player that dies if you would like to only kick yourself you can just replace the @a[scores={deaths=1..}] part with "Your Name"

And if you do use teams, you can keep the team part in the selector and this will kick anyone on that team if they die, just make sure you have specified the same targets in all the command blocks.


This works but I would rather do it like this:

First command:

execute if entity @a[scores={deaths=1..}] run kick @a[scores={deaths=1..}]

Note that you need to specify which player you want to target both in the execute part and in the run part.

Next, it will go into a chain command block with Conditional as before with the command:

scoreboard players set @a[scores={deaths=1..}] deaths 0

Now you only have two command blocks, instead of three:

Command blocks

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .