How to make a spawn system like zo (solved)

So, in Zo players all spawn in a sort of lobby safezone with all the shops and whatnot. Then they can go through a portal and be teleported to the battlefield. Instead of respawning in the lobby after death, players respawn in random areas of the map. There’s also a button to teleport back to the lobby.

How would I go about achieving this system? I know I’d have to use spawn locations. For example how do I make so when players first load in they spawn inside the lobby? Then when they wish to they can go through a portal to the main battlefield. Once they do that they will only respawn on that battlefield until they tp back to the lobby.

Any recommendations or advice on how to achieve this?

[CHAINSAW] ZO ぞ SAMURAI - Roblox

1 Like

put tp points on the map, and when player needs to be spawned, select a random tp point and position their humanoidrootpart using cframe

tp points would act like spawn points essentially

just use math.random(the location of the raycast covering the area, another raycast covering a different area) or teleport the player as @winbloo has said above

How would I make it so they only teleport to spawn points on the map and not the lobby?

then you dont include the lobby spawn point in the math.random()

here is an example

local startSpawn = Instance.new("SpawnLocation")
startSpawn.Anchored = true
startSpawn.Size = Vector3.new(5, 1, 5)
startSpawn.Neutral = true
startSpawn.Parent = game.Workspace
local otherspawn = cframe.new(20,10,0.5)
local startspawn = cframe.new(15, 23, 10)
startSpawn.CFrame = math.random(otherspawn, startspawn)

there is most likely going to be something wrong with it because i am not in studio.

Actually I may have an idea. When players first spawn in they’re on a “lobby team” and will only spawn in the lobby location. Then when they go through the portal they’re removed from the team and it’s all just ffa (free for all) since nobody is on a team. Then I could make an if statement for all of it. (This isn’t exact, just an example) If player.team = lobby team then they respawn in the lobby. (Then when they press the portal they’re removed from the team.) else it respawns players on a random spawn location in the map. Would that work? Someone from HiddenDevs also mentioned I could use tables but I’m not too sure what he means.

then set the original spawn point to the lobby and use DataStoreService as a way of checking if they have joined the game before.

1 Like

then set the original spawn point to the lobby and use DataStoreService as a way of checking if they have joined the game before, and if they have then use the script i used above.

1 Like

Okay this makes a lot of sense. So pretty much could I make it so when players join they’re automatically assigned to a team called “lobby”? While on this team they can’t damage eachother or anything and will only spawn in the lobby. Then they can go into a portal, and be removed from the team. (Quick Question: Would removing them all from this team make it ffa? That’s what I’m going for). If a player isn’t on the team then the script will only respawn them on spawn points in the main map. When a player dies it’ll respawn them at one of those spawn points at random. Then if a player clicks a button to return to lobby it’ll switch their team back to “lobby” and the cycle repeats. Would this work?

basically yes.