creating a dynamic lightbox with image slider that is linked to a repeater

hello everyone,
I have a product page with a repeater in it, the repeater has images. I connected the repeater to a dataset, and the images to the main image column in the dataset. The dataset has a media gallery column which has more images of each product. I created a lightbox and put an image slider in it. Then I linked the images in the repeater to this lightbox. I connected the slider in the lightbox to the same dataset, to media gallery column. But in preview when I click on an image from the repeater, the lightbox would open but the image slider would show a media gallery from the first product in the dataset only. this happens to all the images in the repeater. is there a solution for this