Minecraft – What command can I use to detect when any player is in a certain area

minecraft-commandsminecraft-java-edition

I have tried using commands from /testfor @a[r=4.5], /tp @a[r=4.5], /entitydata @e[type=Player,r=4.5], etc. and nothing works. I want it to teleport any player within range of my machine. It kind of works as a giant portal but it doesn't work without the teleporting part (duh).

Cons: I can't use @e because there's armor stands in the area for other reasons and eventually I'm going to start spawning zombie's in the area for (also) other reasons. I am using 1.10.2 so maybe that's the reason the commands aren't working. Please answer for me and those with similar problems.

Best Answer

You cannot use decimal points in selectors. Try something like:

/tp @a[r=4] X Y Z