how do I do so that if a player not in the group joins he spawns in the team called Civilan
game.Players.PlayerAdded:connect(function(P)
repeat wait() until P:findFirstChild("leaderstats")
local Rank = Instance.new("StringValue", P.leaderstats)
Rank.Name = "Rank"
Rank.Value = P:GetRoleInGroup(2671856)
end)
game.Players.PlayerAdded:connect(function(newPlayer)
local rank = newPlayer:GetRankInGroup(2671856)
local teamName = ""
if rank == 255 then
teamName = "Officers [O1-O10]"
elseif rank == 17 then
teamName = "Officers [O1-O10]"
elseif rank >= 16 then
teamName = "Officers [O1-O10]"
elseif rank >= 15 then
teamName = "Officers [O1-O10]"
elseif rank > 14 then
teamName = "Officers [O1-O10]"
elseif rank > 13 then
teamName = "Officers [O1-O10]"
elseif rank > 12 then
teamName = "Officers [O1-O10]"
elseif rank > 11 then
teamName = "Officers [O1-O10]"
elseif rank > 10 then
teamName = "Officers [O1-O10]"
elseif rank > 9 then
teamName = "Officers [O1-O10]"
elseif rank > 8 then
teamName = "Enlisted[E1-E9]"
elseif rank > 7 then
teamName = "Enlisted[E1-E9]"
elseif rank > 6 then
teamName = "Enlisted[E1-E9]"
elseif rank > 5 then
teamName = "Enlisted[E1-E9]"
elseif rank > 4 then
teamName = "Enlisted[E1-E9]"
elseif rank > 3 then
teamName = "Enlisted[E1-E9]"
elseif rank > 2 then
teamName = "Enlisted[E1-E9]"
elseif rank > 1 then
teamName = "Enlisted[E1-E9]"
end
newPlayer.TeamColor = game.Teams[teamName].TeamColor
end)
