Here's a Roblox spawn script that assigns players to a team only if they belong to a specific group:
groupID = 0000000 --change to the GroupID number
function onEntered(player)
if player and player:IsInGroup(groupID) then
player.TeamColor = BrickColor.new("Really red") --change to color of team
end
end
game.Players.PlayerAdded:connect(onEntered)
Just replace the group ID and team color with your own values, and group members will be sorted onto your chosen team when they join.