2

I am trying to execute a command when a player's kills score reaches a certain value, but it doesn't work.

enter image description here

This image should explain it all.

How do I execute a command when the player reaches a certain amount of score?

2

You have two mistakes in your command.

First of all, your target selector is wrong. Target selector arguments use a <argument>=<value> syntax, meaning it should be score_kills_min=1. A colon as separator is only used for data tags (which you aren't using in this command).

Secondly, the syntax for execute requires 4 arguments before the other command:

execute <entity> <x> <y> <z> <command …> 

Minecraft commands are dumb, they can not divine which arguments are not given when some are missing. In your case, the game sees the following arguments:

<entity> = @p[score_kills_min=1]
<x> = setblock
<y> = 195 
<z> = 56 
<command …> = -1199 minecraft:redstone_block

This is obviously rubbish and the command would fail. If you don't require <command …> to be run from a specific location (if you do, you know), just use ~ ~ ~ for the coordinates.

In summary, your command should be:

execute @p[score_kills_min=1] ~ ~ ~ setblock 195 56 -1199 minecraft:redstone_block
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.