Testing for specific player a with command block
I was trying to make a door that only opened when it was me walking across the tripwire. The first block has the code:
testfor @p[1303,56,518,2,n=PlayerName]
It is impulse, unconditional and needs redstone.
The others use (repeated for all of the blocks):
setblock 1304 56 515 air
They are chain, unconditional and always active.
However the condition for the name doesn't have any effect. I tested it on 2 accounts and the door opened on both. Am I using the syntax wrong or is there something else I'm missing?
**Edit - The problem has been confirmed as the pick block key saving all states correctly other than the conditional.**
it used to save the conditional state since it was originally saved as NBT. However, it was changed later on during the 1.9 snapshots to be a blockstate rather than NBT. The reason behind that is because changing the conditional setting via NBT would not prompt the client to render the block anew, making it appear as a regular command block instead of conditional. Changing a blockstate would allow the client to re-render it. Pick-blocking only saves NBT, so that blockstate is lost. – Skylinerw
Best Answer
If you make a redstone clock connecting to the /testfor command block, it will work. Also, if you do:
/testfor JAMES_the_camel [r=10]
It will test for a player within 10 blocks. Then, if you put a compactor facing away from it going into a command block saying:
/fill ~ ~ ~ ~ ~ ~ air
But instead of having ~, use the coordinates and you can replace air. If you do this, it will test for you and auto open the door. You wont need a tripwire hook at all.
Pictures about "Testing for specific player a with command block"



How do you test a specific player in Minecraft?
You can test for a certain target in the game using the /testfor command in Minecraft.How do you test a player on a particular block?
You can test whether there is a certain block at a specific location in the game using the /testforblock command in Minecraft....TestForBlock Command in Minecraft Java Edition (PC/Mac)How do you test for a specific block in Minecraft?
@p (Nearest Player) If a command block has executed the command, the nearest player to the command block will be targeted. If you run a command from the Chat window, the player running the command will be the nearest player.How to detect a player using command blocks! | /execute command tutorial for 1.16 Minecraft Java
More answers regarding testing for specific player a with command block
Answer 2
Set the desired player(s) into a team, and then select that team, using the commands:
/scoreboard teams add TeamName DisplayName
/scoreboard teams join UsernameOrSelector[team=TeamName]
If you are unsure of how to implement selectors, it is done like this:
/command @a[selector=selectorValue]
If you want to target a player within a certain area, use the [r=Number] selector in a loop command block at the center of a lobby or room. The value "Number" is the square block radius on all axes.
If you know the username of who you want to target, use that instead of the values above like this:
/command FungusKing_III
For the function you stated in the description, you can simplify it massively. Hook the tripwire up to a command block (making sure the command block is powered by an adjacent block) with:
/testfor JAMES_the_camel[r=10]
Or use a |repeat|unconditional|always active| command block anywhere in the world with:
/testfor JAMES_the_camel[x=1303,y=56,z=5182]
And hook that command block up to a comparator that powers the door or a command block that opens it in either case.
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Jim De Ramos, Pixabay, ThisIsEngineering, ThisIsEngineering
