How to get the nearest actor to the player?

guys i have this function so far that gets the location of two actors and give back a float, but I don’t know how to determine which one is sitting at which index in the array. there are only 2 actors in the level btw.

first I get a variable to the first index.

then on the tick I check to see if its not the 0 index so that I don’t check the same actor twice

idk if there are better ways to do this, if there is pls tell me

Just do it once, not on tick…

Or, with get distance to:

i need to have it every frame tho cuz the player is gonna move around

You could do this:

You don’t need every frame, unless the player is a rocket…

i did the same setup but it only passes the second branch once

nevermind i fixed it