I'm trying to make a spawn system where only one player can spawn at every spawn, and I've made a few systems, but the scripting always gets huge, out of control, and doesn't work. It's kind of like the lobby system in literally any battle royale game. I can't offer much more, so, thanks for any help.
A good way to accomplish this would be to create a function/script which does the following when fired:
Pseudo-example:
math.randomseed(tick()) -- Makes math.random less predictable and more random local spawns = {"SpawnA","SpawnB","SpawnC"} -- table of all spawns (in this example just strings) for i,v in pairs(game.Players:GetPlayers()) do -- Loops through all the players local selectIndex = math.random(1,#spawns) -- !Insert code which teleports player to selected spawn! print(spawns[selectIndex],v.Name) -- Print spawn and player's name just to see that it works table.remove(spawns,selectindex) end
Read more about tables here
If you have any questions feel free to ask