Hi there, Is there a way that only one player can go to a different team when S/he joins? So when there is a player in e.g team red,so when someone joins the game,S/he won't be in team red BUT S/he will be in a different team,e.g blue team.
Hope I was specific enough.
Best Regards, |Bob-ThisIsTheBetName18|
You can have a script check how many players are in a specific team and when there's more then one person it teams the person to something else.
If you own a group (which I don't think you do) then you can tell the script to check if one person (like a leader of the group) is in a section of the group. Otherwise, ignore my advice.
The team instance now has events and functions to be able to find who is in that team.
One approach would be to use its PlayerRemoved to add itself back into a list when the player leaves.
Another option would be to look through each team and find one which does not have any players by using GetPlayers.
Example function:-
-- returns the team or false if no team is found with 0 players local function getTeam() for _, team in pairs(game:GetService('Teams')) do -- look through each team if #team:GetPlayers() == 0 then -- check if there are no player return team end end -- no team found with 0 players return false end
There are a different ways of doing this type of thing so use the appreach that best suits your needs. I hope this helps.