How to Make a Working Door in Roblox Studio!
HTML-код
- Опубликовано: 13 сен 2024
- In this video I will be showing you how to make a working door in roblox studio so that you can use it for your very own roblox game where you would need to use doors and to make your roblox game even better.
How to Make a Working Door in Roblox Studio!
✅ SUBSCRIBE HERE! ➜ / @devmelonroblox
🔔 Be sure to hit the bell to turn on notifications!
👍 Be sure to hit that like button!
How to Make a Working Door in Roblox Studio!
#roblox #robloxscripting #robloxstudio #door
🎮 What is Roblox? 🎮
ROBLOX is an online virtual playground and workshop, where kids of all ages can safely interact, create, have fun, and learn. It’s unique in that practically everything on ROBLOX is designed and constructed by members of the community. ROBLOX is designed for 13 to 18 year olds, but it is open to people of all ages. Each player starts by choosing an avatar and giving it an identity. They can then explore ROBLOX - interacting with others by chatting, playing games, or collaborating on creative projects. Each player is also given their own piece of undeveloped real estate along with a virtual toolbox with which to design and build anything - be it a navigable skyscraper, a working helicopter, a giant pinball machine, a multiplayer “Capture the Flag” game or some other, yet-to-be-dreamed-up creation. There is no cost for this first plot of virtual land. By participating and by building cool stuff, ROBLOX members can earn specialty badges as well as ROBLOX dollars (“Robux”). In turn, they can shop the online catalog to purchase avatar clothing and accessories as well as premium building materials, interactive components, and working mechanisms.
How to Make a Working Door in Roblox Studio!
Thanks for watching! Make sure to like and subscribe to see more tutorials like these!
can you put the code in the discription
Yes of course next video I will do this!
why when i click the door nothing happens
For some reason the hinge moves instead of the Door. I’ve checked everything over and over again any idea what the problem is
@@bobthebox8799 i have a problem too when i click at the door the door just falls
For those like me who do not have much experience and want the door to work (since it is likely that on the first try only the hinge part will work) you should only un-anchored the door, now if you need a more detailed door to work replicate the weldcontraint in all the parts you added (works with meshes) and un-anchored each part
It will take some time but the result is worth it :)
15hours ago you commented this. Im a lucky mf you fixed my issue thanks. (unanchoring door) @AlanSosa
Ur welcome body!@@AverageBinn
Thank you SOOOO much, my was so close to throwing my computer 😭
@@Melody_Itzanew lmao me too at the first try
I have a more detailed door and when I unanchor everything the door is just lying on the ground in the individual pieces. Is there anything I can do to try to fix it? my setup rn is pretty messed up tho since I started doing all of this yesterday 😭
for more context, I got my door from the toolbox since I don't really know how to make a good door yet, and all the pieces are a union, not a part. I added the weld constraints to all of them but it's still not working :(
for those wondering why the hinge is the only thing moving after scripting don't forget to un-anchor the door part in the door model under the explorer tab, then try it
Nice!
@@devmelonroblox amaazing video btw, ! thanks for the video, very much helpful
I pray down to you, thank you kind soul, for spreading your much needed knowledge
Also, if your door still doesn't work then you probably didn't put the click detector in the door part.
THANK YOU SO MUCH!!!
Note: Don't anchor the door (not hinge)
Cuz the door will not move
tysm
THANK YOUUUUUUUUUUUUUUUUUUUUUU
I did not anchor the door but it isn't opening
Thanks for this tutorial! Just a little optimization for the Hinge: Duplicate the Part an rename it to "Frame". Set the Hinge Part to transparancy "1". The frame of the door will now remain static.
Nice
Thx
at first i thought that i was getting time scammed , but then i coppied a code and it worked PERFECTLY , thank you😯(
Glad i helped!
I would never scam or lie
local TS = game:GetService("TweenService")
local Door = script.Parent.Door
local Hinge = script.Parent.Hinge
local Open = false
local openState = {}
openState.CFrame = Hinge.CFrame * CFrame.Angles(0, math.rad(90),0)
local closeState = {}
closeState.CFrame = Hinge.CFrame * CFrame.Angles(0,0,0)
local tweeninfo = TweenInfo.new(1)
local OpenAnim = TS:Create(Hinge, tweeninfo, openState)
local CloseAnim = TS:Create(Hinge, tweeninfo, closeState)
Door.ClickDetector.MouseClick:Connect(function()
if Open == false then
Open = true
OpenAnim:Play()
else
Open = false
CloseAnim:Play()
end
end) HERES THE SCRIPT GUYS :DD
this literally helps me sm ty
TYSM
So for some reason i've been looking like actual weeks for a tutorial on how to make a door. Cause I suck at scripting. And uh this is perfect so ty!
hey i have a request, how to make an interactable paper note that appears on your screen when you click on it , and disappears from your screen when click on the image on the screen , and the same thing with a book but you can also flip the pages , and its e to exit
Hey devmelon, i appreciate your tutorial and I do have the thing written down bar for bar. Very cohesive, i applaud you. It does not work. My door is unanchored, my hinge is anchored theyre welded together, ie, ive met all the criteria. I have put in /console during my test run and it says "Hinge is not a valid member of Workspace "Workspace"" and "Cframe is not a valid member of Part "Workspace.gate;model.Hinge"". I dont know where i went wrong
Alright- my problem is line 5. It originally said local Hinge = script.Parent.Hinge, it now says local Hinge = game.Workspace.Hinge. I didn't get the other error, I think this is my problem but I don't exactly know why, because Hinge IS apart of the model.
@@cronus_ampora_totalwizarddeath I think you have ot place the hinge inside the doo im nt sure
It worked that you so mutch 🧡
Thanks so much dude! Im really new to coding and Im trying to learn while going along but this door thing with its tween service and the out of the blue math.rad part really struck me down lol
No problem!
can you send the script@@devmelonroblox
I tried this like 4 times and when I go up to the door it opens the hinge not the door and if i open it once it won’t go back
This helped for my game (subed)😀
Got the code all typed out (since I couldn't find it in the comments) and it works great! If you want to add more details to your door, DEFINITELY make all the different parts into a union so they're all ONE part, I had issues with this but got it to work.
local TS = game:GetService("TweenService")
local door = script.Parent.door
local hinge = script.Parent.hinge
local Open = false
local openState = {}
openState.CFrame = hinge.CFrame * CFrame.Angles(0, math.rad(90),0)
local closeState = {}
closeState.CFrame = hinge.CFrame * CFrame.Angles(0,0,0)
local tweeninfo = TweenInfo.new(1)
local OpenAnim = TS:Create(hinge, tweeninfo, openState)
local CloseAnim = TS:Create(hinge, tweeninfo, closeState)
door.ClickDetector.MouseClick:Connect(function()
if Open == false then
Open = true
OpenAnim:Play()
else Open = false
CloseAnim:Play()
end
end)
i build a whole house while i was in play so when i went out of play everything was gone... 1 hour wasted ..
nice tutorial tho, i will try it again and this time wont build in play xD
Damn that’s sad sorry to hear that! Thanks for watching tho!
dang i feel bad for you
when I click to the door nothing happens can tell me how can I fix it
Anchor the hinge but not the door
@@DanR1skDeah2Risk THANK YOU SO MUCHH
Can you make a tutorial on how to do this but with two doors and with a keybind?
Why do the hinge work but the door doesn't?
Unanchor the Door after you did the scripting
TY for this tutorial!
Hey man i have been wondering how do i start learning roblox lua so i can make stuff work? i wanna become a dev
When I enter the game it immediately says "Door is not a valid member of Part "Workspace.Door.Door" , how do I fix this?
i followed the script and it didnt work and i have no idea why does anyone know what could possibly be wrong?
Is the hinge moving? If the hinge is moving but the rest of the door isn't then it's probably because the door (not the hinge) is anchored. The tutorial says that you should anchor everything for some reason but for it to work make sure the door and any decorations on it are unanchored but the hinge should stay anchored.
Yo can u make sum like when u click the part it will give u food or something?
tbh bro u should put the script in the description so mfs dont have to type for 30 mins trying not to mess up one word
True
How are you gonna learn by copying
@BattleCompanionsGames truw
@@BattleCompanionsGames the problem is that u can by accident make 1 LETTER capitalized and it wont work, sending you into the spiral of insanity for TWO HOURS ;A;
@@TopHatDeveloper thats part of learning. When you make a script it wont work every time
The first code I’ve done which actually works
Whoa nice thumbnail and tutorial funic
Thanks!
using this right now to script for a myth game im making rn and i feel like a goddamn god when im doing it because i have not a clue what im actually doing but im just following the tutorial
heres the code bc ik yall not tryna type allat
local TS = game:GetService("TweenService")
local Door = script.Parent.Door
local Hinge = script.Parent.Hinge
local Open = false
local openState = {}
openState.CFrame = Hinge.CFrame * CFrame.Angeles(0, math.rad(90),0)
local closeState = {}
closeState.CFrame = Hinge.CFrame * CFrame.Angeles(0,0,0)
local tweeninfo = TweenInfo.new(1)
local OpenAnim = TS:Create(Hinge, tweeninfo, openstate)
local Closeanim = TS:Create(Hinge, tweeninfo, closeState)
Door.ClickDetector.MouseClick:Connect(function()
if Open == false then
Open = true
OpenAnim:Play()
else
Open = false
CloseAnim:Play()
end
end)
Hi! I wrote the script but the only thing appearing is the clicking icon and it won't open. does anyone know why.
unanchor the 'door' part inside of the model but keep the hinge anchored
Does anyone know how i can make a sound play when the door opens, but a different sound plays when it closes?
Im not exactly sure but you could probably put the two different sounds at this part of the code so that it can be specified which plays when
Door.ClickDetector.MouseClick:Connect(function()
if Open == false then
Open = true
OpenAnim:Play()
else
Open = false
CloseAnim:Play()
end
end)
Hey, what should I do if my door is multiple parts? (I want my door to look more detailed), because it never works and just moves the main door part but not the rest
You can just weld it all to the part that you wil move
@@devmelonroblox i tried some things to fix it but it doesn’t open, at one point the hinge opened..
@@B-Cat100 Look at the debug menu, it has many bugs.
If it’s on my screen that’s not yo do with the script it’s with my plugins
@@B-Cat100 See the comment below from @Zer0Milk
"Had the same issue, un-anchored the door and it worked. Try that"
This worked for me ;o)
Bro when i press on the door nothing happens what did i do wrong? Is it because i added more things to the model, i also added a handle and all the stuff. Please respond
maybe its too late to respond, but its probably because the door is anchored, and if you want to add more things to the door you have to use a weld or a weldconstraint to attach them to the door and still unanchor the things you added to it, if it dosen't work i don't know what the problem is
am i able to add it as an model not a part for decor?
i used the script exactly but the door rotated the wrong way, what is wrong?
Have you made sure you have:
openState.CFrame = Hinge.CFrame * CFrame.Angles(0, math.rad(90),0)
Hey how so u see if there is weld in a part, I followed every step but the door wouldn't open, can u help me?
In the explorer
When i click on door the hinge is only moving and not the door. Someone know how to fix ?
Unanchor the door maybe?
@@devmelonroblox Tyyyy!!!!
would anyone know how to add sounds to the door?
@@redelement5634 insert a sound in the door and then do sound:Play() when you click the door
I unanchored each door part of my model, added a weldconstraint on each part of my model, removed all welds, i checked script analysis and its saying it doesnt have any errors, yet its still not opening when i click the door, what am i doing wrong?
i finally fixed it
absolutely none of this worked not even the hinge
explain it better please, otherwise i asted a few hours on this
So I've added a little door handle onto it and made sure to weld constraint all the parts to the hinge and i've unanchored the door and door handle however it will not open still.
The door is a weld/It's a ton of parts I welded together into a detailed looking door
Same
How do i actually modify the door? I can't add brick, only one singular part can move!
i dont know how to group stuff😭
i found out how🤑
guys you don't have to type it heres the script copy it from here
local TS = game:GetService("TweenService")
local Door = script.Parent.Door
local Hinge = script.Parent.Hinge
local Open = false
local openState = {}
openState.CFrame = Hinge.CFrame * CFrame.Angles(0, math.rad(90),0)
local closeSate = {}
closeState.CFrame = Hinge.CFrame * CFrame.Angles(0,0,0)
local tweeninfo = TweenInfo.new(1)
local OpenAnim = TS:Create(Hinge, tweeninfo, openState)
local CloseAnim = TS:Create(Hinge, tweeninfo, closeSate)
Door.ClickDetecter.MouseClick:Connect(function()
if Open == false then
Open = true
OpenAnim:Play()
else
Open = false
CloseAnim:Play()
end
end)
Nice
here is a fixed version because he misspelled some things
local TS = game:GetService("TweenService")
local Door = script.Parent.Door
local Hinge = script.Parent.Hinge
local Open = false
local openState = {}
openState.CFrame = Hinge.CFrame * CFrame.Angles(0, math.rad(90),0)
local closeState = {}
closeState.CFrame = Hinge.CFrame * CFrame.Angles(0,0,0)
local tweeninfo = TweenInfo.new(1)
local OpenAnim = TS:Create(Hinge, tweeninfo, openState)
local CloseAnim = TS:Create(Hinge, tweeninfo, closeState)
Door.ClickDetecter.MouseClick:Connect(function()
if Open == false then
Open = true
OpenAnim:Play()
else
Open = false
CloseAnim:Play()
end
end)
@@robloxgrayson2460 thank u very much
for me it does not work :(
😭☹
What exactly doesn’t work?
i try it but it was not opening can u tell the problem if possible ? but clicking icon was coming.
Try unanchoring the door but anchor the hinge
Im trying to weld the door and the hinge but everytime i try to put the door as part0 or part1 it wont weld
how can you make the door slide? and not turn you know like a store door
does it work if the door is not a part but a union?
I believe it works but I’m not sure
@@devmelonrobloxmkay
I'm pretty sure coating is basically just random letters and words and random numbers
When i add a weld constraint to the door part i dont see part0 and part1
heres the script
local TS = game:GetService("TweenService")
local door = script.parent.door
local hinge = script.parent.hinge
local open = false
local openstate = {}
openstate.cframe = hinge.cframe * cframe * cframe.angles (0,math.rad(90),0)
local closestate = {}
closestate.cframe = hinge.cframe *cframe.angles(0,0,0)
local tweeninfo = tweeninfo.new(1)
local openanim = TS:Create(hinge,tweeninfo,openstate)
local closeanim = TS:Create(hinge,tweeninfo,closestate)
door.clickdetector.mouseclick:connect*(function()
if open == false then
open = true
openanim:play()
else
open = false
closeanim:play()
end
end)
Thanks!
how do i make this door work but with proximity prompt instead of click detector
thas what im sayin
how i make a door sound when open/closed
You add a sound into the door and then you say Sound:Play()
it works but it dont like it shows up to open the door but it dont open
What do you mean?
In roblox studio i don’t know if it’s for you too but the clicking icon doesn’t appear
It doesnt work i didnt built a room the hinge has a click icon but if i click it doesnt do anything
local TS = game:getService("TweenService")
local Door = script.parent.Door
local Hinge = script.Parent.Door
local Open = false
local openState = {}
openState.CFrame = Hinge.CFrame * CFrame.Angles(0. math.rad(90),0)
local closeState = {}
closeState.Cframe = Hinge.CFrame * CFrame.Angles(0,0,0)
local tweeninfo = TweenInfo.new(1)
local OpenAnim = TS:Create(Hinge, TweenInfo, openState)
local CloseAnim = TS:Create(Hinge, TweenInfo, closeState)
Door.ClickDetector.MouseClick:Connect(function()
if Open == false then
Open = true
OpenAnim:Play()
else
Open= false
CloseAnim:Play()
end
end)
I fixed it but the hinge moves with the door
@@globlinus make the hinge invisible
Isn’t that supposed to happen?
found it
local Hinge = script.Parent.Hinge
why can't you just put the script in the description
To make people learn
Nice tutorial but i had a hard time doing it but its alright
It didnt work can you just copy and paste the code into the comments please?
underrated
Thanks
@@devmelonroblox yup
yes underrated but good video
@@devmelonroblox you should have twice as many likes
as ten times the amount of likes would be
it doesnt work i unanchored the middle of the mart nothing
Wdym?
My door won’t move :/
Me too
@@C-O-R-R-U-P-T-I-O-N mines fixed now look down in the comments
I t would have be cool if you could have put the script part in comment rather than wasting my time
local TS = game:GetService("TweenService")
local Door = script.Parent.Door
local Hinge = script.Parent.Hinge
local Open = false
local openState = {}
openState.CFrame = Hinge.CFrame * CFrame.Angles(0, math.rad(90), 0)
local closeState = {}
closeState.CFrame = Hinge.CFrame * CFrame.Angles(0, 0, 0)
local tweeninfo = TweenInfo.new(1)
local OpenAnim = TS:Create(Hinge, tweeninfo, openState)
local CloseAnim = TS:Create(Hinge, tweeninfo, closeState)
Door.ClickDetector.MouseClick:Connect(function()
if Open == false then
Open = true
OpenAnim:Play()
else
Open = false
CloseAnim:Play()
end
end)
How to add sound effect tho
You just add in a sound into the door and when you want it to play, in the script you write Sound:Play() Make sure Sound is the name of your sound that you are using
do unions not work?
How can i make it swing out in another direction?
how would i add a doorknob to this model?
You would weld it to the door model
@@devmelonroblox thank you
how do i make it so pressing a key opens it? just replace the .mouseclick with .keypressE?
use a proximity prompt
Is there anything wrong with my script? I tried it and it didnt work
local TS = game:GetService("TweenService")
local Door = script.Parent.Door
local Hinge = script.Parent.Hinge
local Open = false
local openState = {}
openState.CFrame = Hinge.CFrame * CFrame.Angles(0, math.rad(90),0)
local closeSate = {}
closeState.CFrame = Hinge.CFrame * CFrame.Angles(0,0,0)
local tweeninfo = TweenInfo.new(1)
local OpenAnim = TS:Create(Hinge, tweeninfo, openState)
local CloseAnim = TS:Create(Hinge, tweeninfo, closeSate)
Door.ClickDetecter.MouseClick:Connect(function()
if Open == false then
Open = true
OpenAnim:Play()
else
Open = false
CloseAnim:Play()
end
end
I even checked if there was anything missing and there wasnt so idk pls somebody tell me if there is anything different
Join the server I would be able to help you out if you have questions
hmm you spelt state wrong in the closeState script
yeah, and also did you weld the door to the hinge?
so mistakes:
1. you spelled closeState wrong
2. you spelled ClickDetector wrong
3. you forgot to put parentheses at the end of the function
@@robloxgrayson2460 I fixed it and it still didnt work
Why won’t it work, I unanchored it, I rescripted it multiple times, I tried everything I could think of, fixed bugs but it still stood stuck, not moving. I’m about to completely give up.
why not trying to anchor it and check the video?????
im to lazy to type code pls gimme
I need help for some reason only the hinge is moving
script:
local TS = game:GetService("TweenService")
local Door = script.Parent.Door
local Hinge = script.Parent.Hinge
local Open = false
local openState = {}
openState.CFrame = Hinge.CFrame * CFrame.Angles(0, math.rad(90),0)
local closeState = {}
closeState.CFrame = Hinge.CFrame * CFrame.Angles(0,0,0)
local tweeninfo = TweenInfo.new(1)
local OpenAnim = TS:Create(Hinge, tweeninfo, openState)
local CloseAnim = TS:Create(Hinge, tweeninfo, closeState)
Door.ClickDetector.MouseClick:Connect(function()
if Open == false then
Open = true
OpenAnim:Play()
else
Open = false
CloseAnim:Play()
end
end)
ty
@@loganrh no problem!
why is it so that every single door i do that it doesnt work and this ALSO didnt work like the other scripts i looked from yt😔
i made the hinge fuction like a door- how to fix that
Dude after 42:00 seconds you go so fast it is hard for us to understand bro
???? 😂
i want to copy the script tho. where can i get it?
How do I make it so multiple parts move
Weld
Then together
hi could you make a door for my game pls
He showed you how to do it
U cant do it
Yeah i dont understant cant you just make the door yourself? I made a tutorial
Idk what I’m doing wrong I’ve done everything and been over the code multiple times and only the hinge will move when I click the door
Even when I make a new pair of parts the same thing happens
unanchor the door?
@@iwasneverkilled3516 YESS THANKS YOU 🙏🙏🙏🙏🙏
@@Mr-meme12 now how do i make this door work with button interest (Hold F to interact)
@@iwasneverkilled3516 I need help, when I do that the door falls down, it has multiple pieces and I don't know how to fix that so it works
cool
When i click the hinge just disapears
Look at the debug menu, it has many bugs.
My door won’t move so I might just use a free model
For so e reason the door won’t even move?
I did everything right though.
Does the door have to be a part or can it be a mesh?
It can be a meay
why its no working?? bro pls teach me i est it so hard and is not working :(
please paste the script
Why did you SPEED THE VIDEO?! I almost didint see shit!
It moved the hinge instead of the door why
why does only my hinge move and not the door lol
It’s broken I swear I have re-wrote it many times and always only the hinge moves when I click the door
Are you sure you welded it?
@@devmelonroblox I removed all normal welds and added the weld constraint.
(The fact that you replied makes me respect you heavily, you care about your viewers even though you have loads, thank you, you’ve just gotten a sub)
@@devmelonroblox ruclips.net/user/shortsaeMjOkLhpbM?feature=share sorry my laptop looks like 💩
When you click on the door it won’t work
He needs to reach at least 1k subscribers.
Look at the debug menu, it has many bugs.
it doesnt work for me
when i click the door the door isnt moving at all
Same here
It didnt work :(
for cool people (i mean stupid btw)
local TS = game:GetService("TweenService")
local Door = script.Parent.Door
local Hinge = script.Parent.Hinge
local Open = false
local openState = {}
openState.CFrame = Hinge.CFrame * CFrame.Angles(0 math.rad(90),(0
local closeState = {}
closeState.CFrame = Hinge.CFrame * CFrame.Angles(0,0,0)
local tweeninfo = TweenInfo.new(1)
local OpenAnim = TS:Create(Hinge, TweenInfo, openState)
local CloseAnim = TS:Create(Hinge, TweenInfo, closeState)
Door.ClickDetector.MouseClick:Connect(function ()
if Open == false then
Open = true
OpenAnim:Play()
else
Open = false
CloseAnim:Play()
end
end)
Not working :(
it animated the hinge instead of the door.
How do i make a door working with alot of parts?
its easy, you need to make the parts you want to add, make them touch the door, and use a weld, or a weldconstraint to actually attach them to the door, and obviously unanchor them. its better if you put them in the door model