How do I make a level loader so when im close to a game object and i press a button, it changes scenes?

I want to make it so if you press a button, like P or something, and you’re near like the door of a building, it changes scenes and you enter the building. I’ve already made scenes for the insides of buildings and everything, but i dont know how to change it. I’m new to coding, but I have a firm grasp on javascript. Thanks a lot!

I am a beginner too, but i have been doing a lot of tutorials:

you could put a container around that door object that detects collisions with the player object. on collision, it should enable a script that on key down “p” triggers Application.LoadLevel(“building”), you could even trigger a GUI button thats says “press P”

Or skip the key down “P”, and just make collisions with the container trigger Application.LoadLevel(“building”)

loading levels: Unity - Scripting API: Application.LoadLevel
there are some examples of detecting collisions and boundaries in this tutorial:
parts of this splash tutorial could work: - YouTube

Hope that helps at least a bit! Good luck!