Minecraft map spawnpoint for any player that joins [duplicate]

I am creating a minecraft 1.14 puzzle map. I would like to know how to set a spawnpoint for any player that downloads the map. Can anyone help me with this?


Solution 1:

Edit:

Apparently there is a command that makes the world spawn accurate, but I'm not sure how exactly it works:
/gamerule spawnRadius 0

I also had this problem recently on my own server, and I came up with a solution:

Because the command /setworldspawn is not very accurate, you need to set a /spawnpoint for everyone. However, it will work only if they had a spawnpoint before they joined the world, which is impossible to make. We still want to set the spawnpoint though, just in case the player(s) die. Let's say we want the spawnpoint to be at x:0 y:70 z:0. The following command should be put into a Repeat Always active command block (Note: you may set this command to affect only new players, which I will show later on):

/spawnpoint @a 0 70 0

Now you want to teleport all new players to the spawnpoint. First of all, you need a scoreboard to identify the new players, let's call it timeOnline:

/scoreboard objectives add timeOnline minecraft.custom:minecraft.play_one_minute

Now, have a Repeat Always active with a command that teleports all players that are on the server for less than 1 second on the server to the spawn:

/tp @a[scores={timeOnline=..20}] 0 70 0