How can I teleport random players to different locations?

If you know approximately where everyone is going to be before they are teleported (i.e. a lobby), put some armor stands down, name them something like spawn_0 and a bunch of different ones and then tp them with:

execute @e[type=armor_stand,name="spawn_0"] ~ ~ ~ tp @r[x=5,y=10,z=5,r=30] @s

Have that happen as many as you want, like spawn_1, spawn_2, etc. Obviously adjust r for your needs. Adjust x=, y=, z= to where your lobby/place before people are teleported.

If you don't know where anyone is going to be, you may want to look into the /tag command. This answer should suffice for most situations, though.


My answer requires no additional entities. You basically want to number players randomly, and teleport them based on their ID. This is useful because you can then target players based on their IDs.

First, you need a scoreboard objective to hold the players’ ID numbers.

/scoreboard objectives add id dummy

And you need a fake player to hold the current ID number.

/scoreboard players set #current id -1

First, set everybody’s ID to -1.

/scoreboard players set @a id -1

Then, repeatedly run the following commands to increment the ID and give a random player that ID:

/scoreboard players add #current id 1
/scoreboard players operation @r[scores={id=-1}] = #current id

Then, teleport players to different locations:

/tp @a[scores={id=0}] 12 23 34
/tp @a[scores={id=1}] 23 34 45

Remember, the first ID is 0, not 1!