This is probably the code you are looking for with a repeater field. It’s tested and works on my site:
<?php // Loop through a Repeater field
if( get_field('role_network_gallery_repeater') ): ?>
<h2>Photos</h2>
<?php while( has_sub_field('role_network_gallery_repeater') ): ?>
<?php foreach ( get_sub_field ( 'role_network_gallery' ) as $nextgen_gallery_id ) :
if ( $nextgen_gallery_id['ngg_form'] == 'album' ) {
echo nggShowAlbum( $nextgen_gallery_id['ngg_id'] ); //NextGEN Gallery album
} elseif ( $nextgen_gallery_id['ngg_form'] == 'gallery' ) {
echo nggShowGallery( $nextgen_gallery_id['ngg_id'] ); //NextGEN Gallery gallery
}
endforeach; ?>
<?php endwhile; ?>
<?php endif; wp_reset_postdata() //Reset ?>
Cheers