Many cooperatively breeding species live in groups with complex structure-large group sizes, low and variable kin structure, and multiple breeding pairs. Since these mixed-kin groups typically form because of immigration of unrelated individuals of both sexes in addition to limited offspring dispersal, differences in patterns of dispersal can generate variation in group structure, even within the same species or population. Here, we examine how environmentally mediated dispersal patterns influence variation in group structure in the plural breeding superb starling (Lamprotornis superbus), an avian cooperative breeder that inhabits a spatiotemporally variable savanna environment and forms mixed-kin groups with variable group sizes and more than one breeding pair per group. Using 4068 genome-wide polymorphic loci and fine-scale, remotely sensed ecological data from 22 groups sampled across a nearly 200 km2 environmental gradient in central Kenya, we find evidence of not only frequent and long-distance dispersal in both sexes (low isolation-by-distance and weak genetic structure), but also directional dispersal from small groups in lower quality habitat with low normalised difference vegetation index (NDVI) to large groups in higher quality habitat with high NDVI. Additionally, we find stronger genetic structure among groups in lower quality habitat, and higher genetic diversity and lower relatedness of groups in higher quality habitat. Previous work using long-term data from groups in the same population has shown that groups with lower relatedness are larger and have more breeding pairs. Long-distance, directional dispersal to maximise individual fitness can thus lead to smaller and simpler kin-based social groups in lower quality habitat, but larger and more complex mixed-kin groups in higher quality habitat. Such intraspecific, within-population variation in group structure, including variation in kin structure of social groups, could have profound implications for the relative importance of the evolutionary mechanisms (i.e. direct vs. indirect fitness benefits) underlying the formation of cooperative societies.