I am confused by this code. The reason why it is not working though is because when you reach the end of the dataset there is no other items left to call nextPage on. You should be able to just chain the else in another if statement like so:
functionloadSlider(){
if($w("#dataset1").getCurrentItemIndex()===5){
$w("#dataset1").loadPage(1)
}else{
if($w("#dataset1").nextPage()) {
$w("#dataset1").nextPage()
}
}
setTimeout(loadSlider,6000)
}
I don’t think that this is necessarily the best solution but given the context this is the best I can think of.
I might be able to come up with a better solution with more information