2

How can I make a certain radius around a command block, somewhere only certain people can enter, even with /tpo. I want the command block to teleport the people who try to teleport inside that radius to be teleported to certain coordinates. Is that possible? If so, how?

2 Answers 2

4

You could do it by TPing all players not in a specified team away.

Add all players that you want to access the area to a team:

/scoreboard teams add [team name]
/scoreboard teams join [players...]

Then you need a command block in Repeat mode in the area, you can use needs redstone or always active, but I would suggest that you at first run a redstone wire with repeaters and a lever at the end for testing.

Repeating command block command:

/tp @e[r=[range in which players cannot access the area],team=![name of the team that can access the area]] ~40 ~ ~ [you can change the location]

Example:

/tp @e[r=10,team=!access] ~20 ~ ~
2
  • Yup, that's just what I was about to suggest. If you don't mind other entities (eg. minecarts, mobs) being in that area, you can use the @a selector instead of @e. You could also use a scoreboard tag rather than a team for this, but there's no real reason to use one over the other.
    – TenNineAce
    Jan 17, 2017 at 4:26
  • 1.13 syntax: /tp @e[distance=..<number>,team=!<team>] ~40 ~ ~
    – pppery
    Aug 2, 2019 at 19:31
1

You would need to continuously /testfor the area to see if people are in the specified range, etc.
Then you'd link the /testfor command-block to another which teleports the player to somewhere else.

And the good thing about this, is that even if they teleport-in or walk-in, they'll be teleported either way... or is that what you wanted?
Hopefully, my answer assists you in your endeavours.

1
  • I have attempted stuff like that before, but it never worked for me. Jan 24, 2017 at 19:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .