I don’t see any reason that it would be doing that. Try echoing out the id as well and see if you are getting values for different attachments.
foreach ($attachments as $attachment) {
echo $attachment->ID,': ',get_field('custom-field-name', $attachment->ID),'<br />';
}
John I just did as You told me. The situation is the same. As an output i get the same id for every image I attached. And it`s id of first attached image. I edit my old post and add another image and still get only id of first attached image