Hey, so does anybody know what the best way to make a round system for a game with different spawns per player. As an example like horiffic housing, how every player has a different spawn.
That is quite simple really.
When initializing the round, you can have a table to has a list of all the possible spawn parts or spawnlocations (however you want to set it up). Then when looping through the players to initialize, you can give them one of them and remove it from the table storing it somewhere else if you need to.
Example:
function roundInit()
local spawnLocations = {game.Workspace.Spawns.locationOne}
for i,v in pairs(game:GetPlayers()) do
v.SpawnLocation = spawnLocations[1]
table.remove(spawnLocations, 1)
v:LoadCharacter()
end
end
It may not be the best example as it might break the table, but it gives you a basic idea.
After setting their spawns I load their character to make sure they spawn there.
Please note that setting the SpawnLocation property may only work for SpawnLocations (I do not believe it works for regular parts, but I am not 100% sure). If you just disable the spawn being neutral and don’t set its team, it should not give it to anyone by default.
Alternatively, you can just TP them to the location of a part instead.
Edit: I just quickly fixed up a bit of code so the table would shift down.
What would this look like as parts?
You would just put a bunch of parts or spawnlocations in a folder in the workspace. Those parts will be possible locations for a player to spawn.
Thanks for the help means alot!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.