my script doesn't work because I said if the player is rank 0 like not in the group he should be civilan team but he still spawn as a enlisted how do I do so that the player that is not in the group spawns in civilan team
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) ---- Change that number to the ID of your group local teamName = "" if rank == 255 then teamName = "Officer [O1-O10]" elseif rank == 17 then teamName = "Officer [O1-O10]" elseif rank >= 16 then teamName = "Officer [O1-O10]" elseif rank >= 15 then teamName = "Officer [O1-O10]" elseif rank > 14 then teamName = "Officer [O1-O10]" elseif rank > 13 then teamName = "Officer [O1-O10]" elseif rank > 12 then teamName = "Officer [O1-O10]" elseif rank > 11 then teamName = "Officer [O1-O10]" elseif rank > 10 then teamName = "Officer [O1-O10]" elseif rank > 9 then teamName = "Officer [O1-O10]" elseif rank > 8 then teamName = "[E1-E9]" elseif rank > 7 then teamName = "[E1-E9]" elseif rank > 6 then teamName = "[E1-E9]" elseif rank > 5 then teamName = "[E1-E9]" elseif rank > 4 then teamName = "[E1-E9]" elseif rank > 3 then teamName = "[E1-E9]" elseif rank > 2 then teamName = "[E1-E9]" elseif rank > 1 then teamName = "[E1-E9]" elseif rank > 0 then teamName = "Civilan" end newPlayer.TeamColor = game.Teams[teamName].TeamColor end)
game.Players.PlayerAdded:Connect(function(newPlayer) if newPlayer:IsInGroup(2671856) ~= true then newPlayer.TeamColor = game.Teams[Civilian].TeamColor else local groupRank = newPlayer:GetRoleInGroup(2671856) if groupRank <= 8 then newPlayer.TeamColor = game.Teams:FindFirstChild("[E1-E9]").TeamColor else newPlayer.TeamColor = game.Teams:FindFirstChild("Officer [O1-O10]").TeamColor end end end