I'm making a game on ROBLOX and I made a house. I'm trying to script the door so it can function or work but I only know the basics of scripting and I'm bad a scripting. I made a script and it works but after a while it just stops working or not function. I'm very bad at coding so it's not a surprise to me that it doesn't work. I checked the output section and it says that one of my variables is not working but I don't know what to do and I get very confused on what to do. I tried multiple attempts to make the script work but it just failed. Can you please help me fix the script?
If you'd like to see the script here it is:
local DoorA = game.Workspace.DoorModel.DoorA.DoorA local DoorB = game.Lighting.DoorHolder_MODEL.DoorB.DoorB local DoorHolder = game.Lighting.DoorHolder_MODEL local DoorModel = game.Workspace.DoorModel function onClick(click) DoorA.Parent = DoorHolder.DoorA DoorB.Parent = DoorModel.DoorB end script.Parent.MouseClick:Connect(onClick)
I know it's bad but it's the best I could do...
I think this might be very helpful to you: https://www.youtube.com/watch?v=b0GjnMe4Tq4
and: https://www.youtube.com/watch?v=c_J_2fgAV98
and https://www.youtube.com/watch?v=NihGyByDd_4&list=PLuEQ5BB-Z1PKDygk3xYcdRelMWoNFFe3r&index=4
Some of the videos in this playlist show you how to make a working door using spring constraints, I'm pretty sure it doesn't have a lot (if any) scripting. The door opens when the player walks into it and closes shortly after.