0

I am trying to make a command block check a location for a player.

To my knowledge, you do it by putting in /testfor @a[x=X, y=Y, z=Z, r=RADIUS, name=NAME]. However, even though I hooked it up to a clock, when the player is at the location, it does not output a signal but instead just throws the UUID provided in invalid format error.

Whats wrong here?

1

You are making a simple but common mistake: Target selectors must not have spaces. In fact, most arguments must not have spaces.

I.e. your command should be

/testfor @a[x=X,y=Y,z=Z,r=RADIUS,name=NAME]

The reason for that is that Minecraft's command parsing algorithm simply splits commands at spaces to evaluate the arguments of the command. For that reason, only very few arguments allow for spaces, and these will always be the last argument of the command. [dataTag] is the most common case of these.

Looking at the syntax, /testfor <player> [dataTag], what happens with your command is that the game sees @a[x=X, as <player>, and y=Y, z=Z, r=RADIUS, name=NAME] as [dataTag], which is rubbish and caused the command to fail.

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.