Now i know that he is using Game Maker.
Now i'm getting the point. must be a For using an index to go through a list of items inside a queue.
the index must be receiving the length of the list instead of receiving the length minus 1, resulting to an position beyond the list. Dev, Look at this! this is a simple fix!