How do you make something only effect the nearest player?

Hello everyone! I made a basic multiplayer function, I have been in a tight spot where when one player triggers a trigger box and it creates a widget both players have the widget. I’m basically trying to make the trigger box only effect the nearest player. If anyone could help please do, thank you!

On your triggerbox you should have a function called get all overlapping actors. Using that, you will get an array of all actors inside the triggerbox. Then just use the “Get” node on the array and select actor 0.

Note that this may not always give you the correct result, and you would do better to implement a system where the instigator only gets the widget. Such a system would take a bit more time to explain concretely, especially since I have no idea how your game is set up.

Thanks for the help, could you send me a image of what that looks like so I can get a better idea of what to do? Are you talking about making this function inside a blueprint script for the trigger box when you say :

“On your triggerbox you should have a function called get all overlapping actors. Using that, you will get an array of all actors inside the triggerbox. Then just use the “Get” node on the array and select actor 0.”

I created a blueprint script for the blueprint. I searched for “get all overlapping actors” and I found nothing.

( I also did not see a function on the side. )

Since the blueprint for this kind of behavior is a little more complex to get robust, I made a robust version. Copy paste the text file directly into, for instance, a level blueprint and you should have what you need.

Because of the complexity it’s going to be hard to provide a screenshot, sadly.

link text

Thanks this helps!

Thanks this really helps, it works great!