Using Minecraft command blocks to automatically TP players when they join?
Solution 1:
There are several ways to solve your problem. One is the /gamerule spawnRadius 0
command, which will change the spawn point so it is only on one block. Then do /setworldspawn
where you want people to spawn in. Keep in mind, if you've ever done /spawnpoint
in your world, it will override the /setworldspawn
command, so you might want to test it out with a player other than yourself. Another way is what you said to do. You can place a repeating command block that runs the command /testfor @a[
x y z r
]
where x,y,z are the coordanates of the place where the players spawn in incorrectly, and r is the radius of those coordanates where the players spawn incorrecly. Keep in mind that the []
are necessary in that command, and there is no space in between @a
and []
You will need to put a redstone comparator coming out of this command block, and head ing to one that says /tp @a[
x y z r
]x y z
where the first xyzr are the same as before, and the second set are the coordanates of the world spawnpoint.