Controlling when an Input Key can be used

Hi, I have an Input Key (Y) that I’d only like to be usable when you enter a certain trigger box. Anyone know how to do this?