You could technically do this:
…but my gut feeling is telling me we’re approaching it from the wrong end. Something like player input belongs in the player / controller. Hard to really tell what you’re up to, though.
Are you going to implement this script in every object in the game? Normally you’d script interaction like that in the player BP, once.