game.Players.PlayerAdded:connect(function(player) -- function is called when player joins game if player:GetRankInGroup(4980928) >= 238 then --checks if players rank in 2671856 is greater than or equal to 8 player.Team = "United States Military" -- sets players team to officers elseif player:GetRankInGroup(4980928) < 238 then -- checks if players rank in 2671856 is smaller than 8 player.Team = "Basic Combat Training" -- sets players team to unlisted else -- if player meets none of the above conditions player.TeamColor = "Visitors" -- set team to visitors end end) game:GetService("Players").PlayerAdded:Connect(function(Player) if Player:IsInGroup(4986262) then Player.TeamColor = BrickColor.new("Maroon") else Player.TeamColor = BrickColor.new("Parsley green") end end)
game.Players.PlayerAdded:connect(function(player) if player:GetRankInGroup(4980928) >= 238 then player.Team = game.Teams["United States Marines"] elseif player:GetRankInGroup(4980928) < 238 then player.Team = game.Teams["Basic Combat Training"] else player.Team = game.Teams["Visitor"] end end)
You can change it to an object value instead of a string value when changing the player.Team