Best way for referencing?

So I have been having the biggest problems when referencing, as of right now I am using a get all actors of class node with a for each loop and setting the ref, but my problem comes when there is a new instance of said object I.E. : Player or enemy. That references can no longer be found, what is the best way to set this up where the reference can always work?

You need to provide more information, it really doesn’t make sense how your asking it right now. Post a pic of the Blueprint Graph or code snippet if it’s C++. What “ref” are you setting?

If it is your variable’s that you are setting you have control of it, but it’s not clear that you are doing that. GetAllActors of Class will do just that get all of them, if you don’t want all of them there are many other ways of getting a specific one. The EQS system is very good if you are querying based on location and other in world criteria.

here is an example in what I’m working on. I have a few different enemies and a player, and the player has the ability to respawn one time. I actually went through a document in unreal docs for setting up the respawn, so when the player dies and respawns. The enemies can no longer track the player because when they did the get all actors of class the new instance of the player was not created there for could not have a reference. It is the same for my respawn in the begin play of game mode it sets ref to player, and he can respawn 1 time. After that he cant respawn because its a different instance then the one at begin play, and my question is how to get these to rebuild every time an instance is created.