Im having a problem with splitting players. Ive looked through a lot of dev forums, but found none that answer this. Most of them are just talking about an error.
function assignTeams() local balanceTolerancy = math.floor(#plrs / 2) for i = 1, balanceTolerancy do plrs[i].Team = Red end for i,v in pairs(plrs) do if not plrs[i].Team == Red then plrs[i].Team = Blue end end end
Hello!
The ROBLOX Developer hub has created a good article on Team balancing, and how to use it in your game! I suggest you do more research here; as most of what you can find on the DevForums will sometimes be specific to players games, and their own ways they've done it. If you are learning; the best bet to use is the ROBLOX Developer Hub as it's the standard way most new comers to LUA Learn!
Here is the link - https://developer.roblox.com/en-us/articles/team-balancing
~BryanFehr
BryanFehr#3070