Minecraft command block testfor certain player

minecraft-commandsminecraft-java-edition

I am trying to make a command block that when powered, it will looks for a specific player in a 5 block radius of the command block. I tried

/testfor @p[r=5][name=<name of player>]

but it doesn't work.

Best Answer

You can't use two [] next to each other.

/testfor @p[r=5,name=<PlayerName>]

Use a comma to separate different values. Don't add another [] next to it.