how do i get something to happen when the user presses a key but only inside a trigger?

the above- that's all there is to it.

When the player enters the trigger, you gain reference to the player's collider and thus any scripts attached to the player's game object as well.

You could achieve your desired result with 2 scripts; the first attached to every trigger and then your player controller script which is getting control input and making your character move.

When your player enters a trigger, OnTriggerEnter(Collider other) is fired. You then get reference to the player's control script and set a boolean variable (something like isInTrigger makes sense) to true. When the player leaves the trigger OnTriggerExit(Collider other) is called and thus you can use the same method to set that boolean to false.

Now, inside your input loop of the player script you just need to check if isInTrigger is true when the user is pressing the desired key, if so do whatever it is you want to do, if not, move on.

Hope that helps.

==