Problem with Lock On System Array: Target Cycling

Hey guys, so I’ve been working on my senior project for school.

Its a cyber punk action game that has Dark Souls like Combat.

Right now I’m having a bit of a problem with the lock on system. Originally I had it set up to lock on to the nearest target with a line trace array. After the target was killed the camera would auto lock to the next nearest target, or simply unlock if there were no targets in range.

Once the single target lock on was working perfectly my project partner and I wanted to implement target cycling using directional inputs from a controller’s right stick. It is working but not as intended.

If there are more than two targets in any level, the lock on system will no longer lock to the nearest target but will force you to find one specific enemy in the level to lock onto first before you can begin cycling through targets.

We thought we could set the Lock On int after the line trace detected the nearest target but this doesn’t seem to be working.We also have the enemy BP set up to clear the array after death.

The blueprinting is a bit messy and I apologize for that, we’re still both learning, but we’d really love to fix this bug.
Any help or suggestions would be greatly appreciated.

Thanks in Advance.