Rotate Turret to Tag

Hey guys, I’m making a Multiplayer game with Photon networking.
Well anyways, I’m not asking for advice on Networking, I can do that part.

What I’m trying to figure out is.

I know there is a Transform.LookAt(Name of Variable);

But that wont work the way I want, as I will have players leaving and joining games all the time.

I really don’t want to put in an Update function to keep searching for new players when I know there has to be another way to do this.

I have a trigger zone, with an OnTriggerStay and OnTriggerExit.

Well, I have the tags of “Red” and “Green”.

Well, how do I make this turret rotate to a tag that enters if I can’t use transform.LookAt?

I need to have the model rotate towards player and have the BARREL rotate up and down just encase enemy is higher or lower than the barrel.

I don’t have any code because I can’t get anything I try to work at all.
I know it’s something simple, I just can’t quite grasp how to rotate to only a tag that enters into the Trigger Zone.

I want an effect like this. As you can see, I have the top part that rotates left and right and the boxy looking part that lifts the barrel up and down.

I don’t need an ultimate way of doing this, just a hint on what I need to look up to get this to work. As I’ve always used transform.LookAt. I don’t know anything else to use.

You will have to find the closest object of a tag, you could have a list List for red and green that you add to or remove from when a new player enters/leaves your trigger area rather than in update, that would be quite efficient. Then you can loop through that list and find the closest transform, once you have that, you could have a look at my answer or even the code in the question HERE for how to rotate parts on separate axes.