Moving multiple items in a loop doesn't work for some reason

Trying to figure out what’s the problem with this code, it seems to move only the first object instead of iterating across all the objects do you know why?

for (let i = 1; i < SaveItemslength; i++) {
selection.items = null;
selection.items = SaveItems[i];
SaveItems[i].moveInParentCoordinates(300,0);
}

We’d have to see more code (how are SaveItems and SaveItemslength set up?), but note that you don’t need the selection.items manipulation to do the moveInParentCoordinates().

if I remove the line you’ve mentioned it goes like this
the problem it only moves the first item, not all of them

let SaveItems = selection.items;
let SaveItemslength = SaveItems.length;
selection.items = null;

for (let i = 1; i < SaveItemslength; i++) {
SaveItems[i].moveInParentCoordinates(300,0);
}

Simplest way (don’t muck with the selection unless you need to–principle of Least Surprise) might be

selection.items.forEach(item => item.moveInParentCoordinates(300, 0))

the problem is that I need to skip some of them according to a condition.
in my example I skipped the first one

is there a way to do that with forEach?

Yeap you can add if blocks in forEach

okay, I’ll give it a try