Roblox Studio Tutorials - October 6, 2021

How to Open a Door by Pressing “E”


Buzzy Beth


Download – Door Model and Script

How To – Make a Door that Opens by Pressing “E” on Roblox Studio

What’s up everyone welcome to buzzygames, my name is BuzzyGamesBeth and today I’ll be teaching you how to make a door that opens!

  • Right now i’m gonna go ahead and create a very, very simple door. I’m gonna start off with one part and then just resizing it and things like that. Let me go ahead and change the color to dirt brown and then the material to let’s do wood, yeah that looks pretty good!
  • Okay so i’m going to go ahead and grab another part and scale it to the size of the doorand this is going to be my hinge part. The door is going to do the part that’s opening the hinge is going to be in place and then i’m going to change the colo rto black- that looks pretty good!
  • Rename my door part to “door” and the hinge part to “hinge” and then i’m gonna delete these things real quick, you don’t need them.
  • Next up i’m gonna create a weld constraint from the door to the hinge. So the door to the hinge not the other way around.
  • I’m gonna group this, the two parts together and just rename the door. It’s a model now, inside of our door part we’re going to go ahead and add a proximity prompt and inside of our door model we’re going to add a script
  • Delete that print statement
  • Before we actually move on let’s go ahead and duplicate the hinge part and then rename that to “side” and you’ll see why in just a second. You don’t have to add this if you don’t want to, but I like this just so that it’s smoother when I open the door
  • We’re going to define our variables right here. We have our tweenservice which is that smooth animation that we really love!
  • So we’re going to go ahead and do some quick math where anytime the door is open it’s going to you know open the door 90 degrees and then if it’s closed it’ll close it in the same position at 90 degrees.
  • We have our tween info the open and closed, so that anytime the door is open it’ll play that smooth animation 90 degrees open and then smooth animation 90 degrees closed.
  • If we hop into our game and we press “E” the door opens and closes, but if you check it out, you see how the hinge anytime we open and close the door and it doesn’t look that great right?
  • That’s where our side part that’s why we duplicated the hinge part earlier! So that we can just change the transparency of this hinge to one and when you hop into the game, look at how smooth it looks now!
  • Pretty neat right? So we added the side part earlier so that you can you see the side part isn’t moving it’s only the hinge part that’s moving, but because it’s transparent, it has like this very nice opening flow to it when you open and close it!