# How can i get this working properly?

Im trying to make a room accessible to certain people. I made a deathCount objective named Deaths. Now what I want is this: If a player has 0 deaths and is within 4 blocks of the doorway[20,107,298,20,108,298] then it fills up with air. If the player does not have 0 deaths and is within 4 blocks then it fills with iron bars.

I have classes set up to give the player 1 point to Deaths so no player with a class may enter the Class Selection room until the reset the class which i have commands set up for that as well.

• At the moment im trying to work on a different way of locking the room. Im using a teleport to the room rather then walking through. Id still like the iron bars though. – Gabe Apr 1 '15 at 4:28

"CB" = "command block"

`The stuff like this` is explanation of the respective command block's commands

CB 1 and 3 are a clock. They are powering CB 2 and 4 20 times a second.

CB 4 detects anyone in a 4 block radius of the door (`/testfor all players at coords x y z within radius r with a score minimum and maximum of 0`). This means that only people with a death score of 0 will trigger it.

When CB 4 is triggered, it turns the comparator on. This powers CB 5, which removes the door for the player to walk though (`fill from coords x y z to other coords x y z with air`). When the player is out of range, the comparator turns off, and the redstone torch on, powering CB 6 (`Same idea as CB 5`), closing the door.

On the far left the command block teleports anyone with a death score of one or above outside the box. (`teleport everyone with near coords x y z with radius r with a minimum death score of 1 to other coords x y z`)

• Explaining how this works would improve the quality of the answer. – Frank Apr 1 '15 at 19:48
• it is quite self-explanatory testfor, amazingly tests for something and fill... fills things. The testfor detects anyone in a 4 block radius of the door with a death score of both max and min of 0. It then removes the door for the player to walk though. when the player is out of range it replaces the door. On the far left the command block teleports anyone with a death score of one or above outside the box. – stopit25 Apr 1 '15 at 19:54
• Then there should be no issue editing your answer to include that information. – Frank Apr 1 '15 at 19:56
• Is that a little better? – stopit25 Apr 1 '15 at 20:01
• @stopit25, for the commandblock clock, instead of having two blocks, one creating the redstone block & one destroying it, get rid of the bottom one & change the top one to `setblock ~ ~-1 ~ redstone_block 0 destroy` ;) – Quelklef Jun 29 '15 at 17:54

when you put the command in for the selector have it say @a[score_Deaths=0] this tells the game that if you have a score higher than zero, this doesn't apply to you