Array "Get" not returning element?

I have created a function that allows me to organize the characters of my game in order of their speed stat. This function is based off of that found in this post:
I have encountered an issue that I cannot understand. When I run the game the characters are created correctly and they are added to the character roster, which then transfers to the “Play Order” array. For some reason the “Get” node to get array element isn’t giving a result so the entire function fails and the game errors.

you realize your getting index -1 right. your getting all characters, then running a for each, the first index in a array is 0 which your setting to index of current, then your subtracting one from that and trying to get play order index -1.

that could be part of your issue though i dont think its the complete story.

hmmm when i had to do something like this before i used a slightly different technique. what i did was i would take the array of characters, add index 0 to the act order (since theres no one faster in the empty array). then for the rest of the characters i would compare their speed to all the characters in the act order array. if you find a character that your test case is faster than then you insert the test into the array at their index.

below is a example of something like i mentioned.

So I thought that was the issue but; first I have used this function verbatim before and it works, second it will try to get element -1 the condition will fail so the while loop will move on to next iteration which will result index 0, at least to my understanding.

As said in the post this is based of someone else’s organise function and that’s how they had it and as said it has worked for me before.

Also I tried simply inputting the value 1 into the get index, still no result.