Well, this question isn't obvious at all!
Fortunately, you can easily retrieve the selected actor using $gameParty.menuActor(), so your snippet will look like this:
$gameParty.members().forEach((actor) => actor.removeState(5)); var target = $gameParty.menuActor(); target.addState(5) $gameTemp.reserveCommonEvent(3)
By the way, that's an RPG Maker core code function and not an MK exclusive.
PS:
I also added a one-liner at the top to clear the state from all other members, you can of course remove it if you don't need it :)