Changing Scenes With Button When in range:

Hey i have a quick question. I want my game to be able to do something:
Ok so when my character comes into position of the building he/she needs to enter a text element pops up saying ‘Press ‘G’ to enter’ now that i have that how would i be able to press ‘G’ and enter a new scene when that happens?
This was an example of my code:

if (buttonClicked) {

@Nathan_Hawkins1, you can just compare the x, y, and z coordinates of the building and the player. If they are close enough, then display the message.

tryed that but nothing happened.