Look at the Minecraft-Wiki entry for Spawn .
Player Spawning Since Minecraft version 1.3, players in both singleplayer and multiplayer will spawn, by default, anywhere within a 20x20 area centered at the world spawn point .
An individual player can change their spawn point by merely lying in a bed—they do not have to go to sleep (which can only happen if all players use a bed at the same time).
Unlike spawning at the world spawn, a player's spawn point is set at specific coordinates; the player will always respawn on the same block.
This block is also where the player is placed when the player gets out of the bed.
If there are transparent blocks over the spawn block, the player will be respawned on top on the blocks, but will get out of bed inside of them on the same level as the bed.
Emphasis mine.
Setting only the worldspawn will not help you ,you need to set the players' spawnpoints.
So the command you should be using instead is /spawnpoint <player>
<x
> <y
> <z> which will actually set the spawnpoint as if sleeping in a bed
(see Commands ).
Just use @a to set it for every player at once.
As Rokk points out, this will not work for "Lobby" areas (i.e. where you will spawn when you first enter the world as a new player), since you need to run it for every player, and you can't run it before a player first spawns.
For this case, I suggest a sufficiently large (i.e. 20x20 or greater) spawning area, set with /setworldspawn .
Note that you spawn on the top blocks in the set area, so building it underground will not work.
gaming.stackexchange.com/users/74333/MrLemon
Try using the a repeater with a command block that states: " /spawnpoint @a[r=<size of spawn from the center, outwards>] <
x> <y> <z> " This will ensure that people within the specified area (within the [r=
<>] circle) will have their spawnpoints set to the coordinates and as soon as they leave the range, they can set their spawnpoint anywhere else.
No pressure plates or tripwires required.
gaming.stackexchange.com/users/117526/framzero
Try /gamerule spawnRadius false
gaming.stackexchange.com/users/192086/user192086
You could set the default gamemode to adventure mode (in adventure, minecraft spawns the player directly on the block) and then put a pressure plate at the spawn point and set the player to survival or creative.
gaming.stackexchange.com/users/128545/THE EMERALD TRACK
While MrLemon's answer is probably the best way to go, you will have to repeat it every time a new player joins for the first time.
I suggest installing Bukkit and using a plugin to set a specific spawn.
Alternatively, you could just make the spawning area 20x20.
gaming.stackexchange.com/users/79446/Hugo Zink
As MrLemon pointed out, players always spawn randomly in a 20x20 area around the world spawn.
If you want to set each player's spawn point to a specific location, you could put the world spawn point in the middle of a 20x20 area of tripwires, which then activate command blocks setting the spawn point of all the players inside the area to wherever you want it to be, and then teleport them there.
It's what many minigames do.
gaming.stackexchange.com/users/80646/ethanwu10
One way i do it is to have a repeater constantly repeating /spawnpoint @a ~ ~ ~ the whole time until they leave spawn and go over a pressure plate that uses setblock commands to disrupt the redstone clock repeating the spawnpoint command and then after leaving spawn they are free to set spawn where ever they want!
kind of technical but not really.
gaming.stackexchange.com/users/105538/tree_puncher5
What I do is have the first time players on my Realms Server spawn in a huge square, and when they leave they step over a pressure plate that sets their spawn.
Try that, you might like it.
gaming.stackexchange.com/users/115311/user115311
I am trying to make a Minecraft map but I can't set the world spawn. I did  /setworldspawn  then  /kill  and I ended up 10 blocks away then I tried again I was still 5 blocks away.   In the map it needs to keep updating your spawn point and having it not not working correctly is not an option. In one case I set the spawn, and then ended up in the next level of my map, which is clearly not intended.
setworldspawn is not spawning players to the exact place
gaming.stackexchange.com
<minecraft-java-edition>
gaming.stackexchange.com/questions/174332
gaming.stackexchange.com/users/77479/Kingbluesapphire
Set default gamemode to adventure mode, install Bukkit and use a plugin to set a specific spawn.  There isn't a simple or a specific way to spawn players in exact positions. Furthermore, while there are plenty ways to do it, the most common are to either use mods or use presure plates in combination with redstone.
The community suggests tips in order to spawn players in exact places.