Get player who pressed key

I am working on a blueprint which represents items which are collectible. It listens to an InputAction which in turn should fire an event in an instance of a PlayerCharacter blueprint. How would I go about determining the player which triggered the InputAction if there were multiple players in range of the collectible?

Hello lukas.123,

I’d like to help you find out how to do this but first I need to ask, what type of multiplayer is this? Is this an online multiplayer setup or is it local multiplayer with multiple PlayerControllers?

Sorry for my late answer. I’m developing a single player game, but I want to implement it so that theoratically the code could be reused for a multiplayer game since I think it is bad style to just take the controller of the player with index 0 (for example a multiplayer RPG).

Setup would change drastically from a local multiplayer perspective to an online multiplayer one. The multiplayer one would actually be an easier set up for this particular issue as you could just see which client is giving the input.

For local multiplayer however, I would assume that the players would be using Gamepads. If they are, that may be difficult to differentiate.

However, if you have 1 player on the keyboard/mouse, another player on the Gamepad, or two players on the same keyboard just using different keys as some older games did in the past, it would be easy to differentiate due to how input events are set up.

Which of these are you trying to aim for?

We haven’t heard from you in a while lukas.123. Do you still require help setting this up? Please take your time and when you’re ready, let me know the information from my previous comment. I’ll be marking this as resolved in the meantime for tracking purposes.