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?
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
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, and if they have then use the script i used above.
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?