Hey scriptinghelpers, I have a max 10 players with 10 teams, and I'm looking to put 1 player per team. From what I understand on https://developer.roblox.com/en-us/api-reference/class/Team it says "When a Player
joins a game, they will be allocated to the team with Team.AutoAssignable
set to true that has the fewest players. If no auto assignable team is available, Player.Neutral
will be set to true". Since I can't test it myself for two reasons, my computer is NOT fast enough to run 10 different players (I'm just a poor boy doing this as a hobby) and, it will only let me test 8 different players. How would I achieve my goal of putting 1 player per team (10 max players 10 teams). Does it do automatically in my case or, do I need a script for this?
Thanks for the help in advance, I really appreciate it. I'm only here to learn! Side note: A lot of the stuff I'm doing now I'm extremely new to it so I don't actually know everything yet. This would be my first time actually using teams. Also somebody might say "this isn't a scripting question" but, it actually is. I'm wondering if I need scripting for it or, of it's automatic. I don't understand since, I can't test it and I don't have friends who will test it with me.
I've actually been looking at sample code and models but, I'm not finding the answer to my question. It would be on player added (like it says in the title) NOT on player touched because, this isn't for a tycoon. I need the colors from the teams for a tool I'm working on. Meaning I'm assigning a different color to each player.
I think you might need a script. it randomly assigns a team, even if the team has a player alr.
So perhaps you can put this script in server script service?:
local Teams = game:GetService("Teams") assignableTeams = {} for i,v in pairs(Teams:GetDescendants()) do if v:IsA("Team") then table.insert(assignableTeams, v) -- for now all teams are assignable so we will add all teams to the table end end while wait(1) do for i,v in pairs(Teams:GetTeams()) do local playersInTeam = v:GetPlayers() -- returns all players assigned to the team if #playersInTeam == 1 then v.AutoAssignable = false -- make it unassignable since it is occupied. table.remove(assignableTeams, i) -- the team is occupied, so remove it from the assignable teams table end if #playersInTeam > 1 then -- if more than 1 players is in a team for i,v in pairs(v:GetPlayers()) do if i == 1 then print("something here lol") -- skip the first player in the team else v.Team = assignableTeams[math.random(1, #assignableTeams)] -- reassign the other player's team end end end end end