1

For a project I'm working on, I want to be able to execute a setblock command at a player with a certain score. I've tried doing

/execute @a[score_xp_min=100] -insert command here-

but all it says is that I've provided an improper UUID format. Is there any way to /execute commands at players with certain scores?

2 Answers 2

4

The selector format is correct, but the problem is that the syntax of /execute is:

/execute <Target> <X> <Y> <Z> <Command>

To fix your problem simply add 3 tilde (~) after the @a selector:

/execute @a[score_xp_min=100] ~ ~ ~ <Command>
1
0

That's easy, just run this command once:

scoreboard objectives add test dummy "test"

Then have a repeating command block with this command:

execute as @a at @s if score @s test = @s 3.. run [enter command here]

You can change the 3.. to whatever number you want to test for, for example 5..

You can add, set, and reset the points with these commands:

scoreboard players add [player] test [amount]
scoreboard players set [player] test [amount]
scoreboard players reset [player] test

And for all the above commands, you can change the word test to whichever objective name you'd like to use.

1
  • Welcome to Arqade, and thanks for the answer! It looks like you tried to give a scoreboard setup, but there is a problem with the second command: it's throwing an error. The error message reads as follows: Unknown scoreboard objective '3..'. Would you mind fixing your commands here?
    – One 2 Many
    Feb 22, 2022 at 6:40

You must log in to answer this question.

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