How do I check if a player press for example the button R while being in (touching) a part?
For this you'll have to make a UIS (User Input Service) event that triggers when a client provides input. After the event triggers, you need to write a conditional to see if the the button you want was pressed. If the conditional passes, then there's a few methods to see if they're touching the brick.
Distance from the player from the brick. Simply use Pythagorean Theorem and detect how far the block is from the humanoid, typically by torso or head. If it isn't within a certain range, it fails. Pros to this is it would be more efficient and would fail less, but by doing so it could be triggered when their humanoid isn't actually touching. (This is probably the best way)
A block surrounding the brick you want to touch runs :GetTouchingParts() after doing so check to see if any parts touching are descendants of a player-character.
A block below or surrounding the player that runs :GetTouchingParts() that's welded to the character. Rest is the same as number 2.