I'm currently trying to set it up so that players get placed into teams based on a group rank (such as rank ID, most likely.) Because, for example, I want the first rank, "Recruit," to go into a team named "Recruit." But then, I want the next 3 ranks, Private, Private First Class, and Corporal, to go into a team named "Low-Rank." How would I do this?
put this as a "Script" so it can run on the server (which means it shows on everyones screen since client means it only shows on one persons screen)
script is in serverscriptservice, explanation and comments in code block below.
local Teams = game:GetService("Teams") --Get the teams service. game.Players.PlayerAdded:Connect(function(Player) --Checking if the game added a player to the game local PlayerRank = Player:GetRankInGroup(123456) --Get the players rank. Replace 123456 with your group ID. if PlayerRank == 1 then --If your confused on the number, go to your group configuration and look at the roles and check the role ID. Usually 1 is a low rank. 255 is the group leader. Player.Team = Teams:WaitForChild("PutYourTeamNameHere") --Set the players team to whatever the team name is. Replace PutYourTeamNameHere with the team name. elseif PlayerRank == 255 then if PlayerRank == 1 then --Same thing, if your confused on the number, go to your group configuration and look at the roles and check the role ID. Usually 1 is a low rank. 255 is the group leader. Player.Team = Teams:WaitForChild("PutYourTeamNameHere") --Set the players team to whatever the team name is. Replace PutYourTeamNameHere with the team name. Also, WaitForChild means waiting for the team to show up in the game. elseif PlayerRank == 255 then Player.Team = Teams:WaitForChild("PutYourTeamNameHere") end end end)