Ok you are using two arrays that makes more sense. Sure share the file and say what's expected or how to easily test the item.
Also please explain the use of loopindex-1? That's unusual. Set Animation to array.at(1,-1) would be the output. Maybe that is where the problem is.