I would like to make a detector in minecraft that makes it so when a player is in a specific location, that player will be teleported to a certain location.
Is that possible?
If so, may I have an example of the command?
(Only in command block form please)
Minecraft – Command Block Teleportation
minecraft-commandsminecraft-java-edition
Related Topic
- Minecraft – how to make setblock a command block with a command that is executed at a certain player
- Minecraft Command Block Problem
- Minecraft – How to make a rain of arrows in vanilla Minecraft using command blocks
- Minecraft – How to “block off” an area with command blocks
- Minecraft – Using execute command to teleport a player under a certain height
Best Answer
Yes that is possible! It is actually very easy...
Command Set Up
If you want to get a player from a area you need a target selector. For your example the
@a
fits the best. If you have a target selector you are able to use target selector arguments. And with them you are able to define the area.There are some more possibilities than the one I show you. I recommend you to select the players by volume. That means you have two points and all players within these points are selected.
Usage of selection by volume from the minecraft gamepedia.
The command I use looks like this:
Here is the explaination of the command if you do not know how to use it!
The syntax of a tp command looks like this:
The target player in your example are all players in the area. So you have to use the
@a
what selects all players.Furthermore you need something that restricts that
@a
so that only the players in a area are selected. For that you need the selection by volume. It is written right behind the@a
.As I said before you need two points to select a area. The first point (1 in the picture) is the commandblock and you do not need to type it in the command. The secound point (2 in the picture) needs to be in the command.
So you have to type the information how far this point is away from the commandblock. In my example I made a cube wich is 10x10x10 big. So I have to type [dx=10, dy=10, dz=10] and the area gets expanded by ten on each side.
The last three digits are the coordinates where you want to teleport the players. The first is the x, the secound the y and the last the z.
You are able to see the coordinates if you press F3 on your keyboard.
Automatic Teleporting Set Up
I do not know now if you want to teleport the player if he enterd the area or if you press a button. If you want to control it you just have to add a button with redstone to the commandblock.
If you want that a player is teleported when he is entering the area you have to use a redstone clock. Keep in mind that a redstone clock needs some server ressources. So use them as less as possible!
You are able to turn the teleportation on and off with the levler of the clock.