1
I want to know how could i make a system where, when a player enters a room , automatically a barrier blocks the room entrance
And when the player leaves the room the barrier goes away.
Any idea on how to implement it, ive been trying but no luck .
And when the player leaves the room the barrier goes away.
Any idea on how to implement it, ive been trying but no luck .
2
Thank you, thats what i needed
You could use a repeat command block with the command /testfor @p[r=enter radius here]. If you make the radius end at the entrance, when a player walks into the radius, it will activate the command block. From there, place a comparator coming out of the testfor command block into a second one. The second command block should be an impulse with the command /setblock barrier ~ ~ ~. The squiggly lines are where you enter the coordinates of where you want the barrier to be. To have the barrier removed, do a similar set up on the other side of the entrance so that it testsfor when they leave. Use another comparator to set the barrier blocks to air. Remember you either need to have the test for command blocks always active and repeat blocks, or you can use a Redstone clock. Hope this helps!
