|
| 02 Feb 2017 05:44 PM |
So I have started making a new House tycoon game, and it will be my first official game, so yea I will have a few modern doors, and I'm not that good at scripting. So I watched a tutorial on making a sliding door, and I did it but it isn't working, and I need to know what's wrong with the script. Here's the tutorial I watched: https://www.youtube.com/watch?v=ZnBz_kbSnm8&t=967s I don't know whats wrong, but I'm sure its to do with the way my door is set up, the door is 1 group with 3 groups inside, which one of em' has a group for the handle and there's a script yeah? And this is the code I had to type in, and because that my door its a little more complicated than the one that the guy who made the tutorial, it's gonna be complicated for me, and I'm not all that good at scripting, but I like to give it a try. But yeah here's what's in the script:
door1 = script.Parent.Part01 door2 = script.Parent.Part2 door3 = script.Parent.Part3 door4 = script.Parent.Part4 door5 = script.Parent.Part5 door6 = script.Parent.Part6 door7 = script.Parent.Part7
doorClosed = true
script.Parent.Censor.Touched:connect(function(hit) local h = hit.Parent:FindFirstChild("Humanoid") if h then if doorClosed then doorClosed = false for i = 1,30 do door1.CFrame = CFrame.new(door1.Position + Vector3.new(0,0,0.2)) door2.CFrame = CFrame.new(door2.Position + Vector3.new(0,0,0.2)) door3.CFrame = CFrame.new(door3.Position + Vector3.new(0,0,0.2)) door4.CFrame = CFrame.new(door4.Position + Vector3.new(0,0,0.2)) door5.CFrame = CFrame.new(door5.Position + Vector3.new(0,0,0.2)) door6.CFrame = CFrame.new(door6.Position + Vector3.new(0,0,0.2)) door7.CFrame = CFrame.new(door7.Position + Vector3.new(0,0,0.2)) wait() end for i = 1,30 do door1.CFrame = CFrame.new(door1.Position + Vector3.new(0,0,0.2)) door2.CFrame = CFrame.new(door2.Position + Vector3.new(0,0,0.2)) door3.CFrame = CFrame.new(door3.Position + Vector3.new(0,0,0.2)) door4.CFrame = CFrame.new(door4.Position + Vector3.new(0,0,0.2)) door5.CFrame = CFrame.new(door5.Position + Vector3.new(0,0,0.2)) door6.CFrame = CFrame.new(door6.Position + Vector3.new(0,0,0.2)) door7.CFrame = CFrame.new(door7.Position + Vector3.new(0,0,0.2)) wait() end doorClosed = true end end end)
So that's the script, and also the output comes up with an error for me that I do not know how to solve, and that's the main reason why I need help, I want to know how to fix the problem to make the door work. "Part01 is not a valid member of model."
So yeah, that's my problem, I watched a video on how to make a door slide, my door was a little more complicated, so I got an error, error pops up in output and I don't know how to fix it. If you help me then thank you. Thank you.
|
|
|
| Report Abuse |
|
|
| 02 Feb 2017 06:00 PM |
| 1.) I would group all #### ##### into a table to be iterated over using a for loop. 2.) I would fix the problem with your door tweening one way twice 3.) You need to indent your code. Badly. If you pasted this, it should have tabs. 4.) In the parent to the script, an object named Part01 doesn't exist |
|
|
| Report Abuse |
|
|
| 02 Feb 2017 06:03 PM |
Tags. I'll try out what you said.
|
|
|
| Report Abuse |
|
|
| 02 Feb 2017 06:05 PM |
Also I didn't paste it from the tutorial, I pasted it from what I typed in myself using the what the tutorial said.
|
|
|
| Report Abuse |
|
|
| 02 Feb 2017 06:06 PM |
Sorry for replying again lol, but Part01 does exist, it's in the group :/
|
|
|
| Report Abuse |
|
|
| 02 Feb 2017 06:12 PM |
I did the part that I could that you said, but I couldn't do the tagged out part. This is what it says now:
door1 = script.Parent.actualdoor
doorClosed = true
script.Parent.Censor.Touched:connect(function(hit) local h = hit.Parent:FindFirstChild("Humanoid") if h then if doorClosed then doorClosed = false for i = 1,30 do door1.CFrame = CFrame.new(door1.Position + Vector3.new(0,0,0.2)) end doorClosed = true end end end)
And this is what the output says: actualdoor is not a valid member of Model.
And I know you said that it means actualdoor does not exist, but it does exist, otherwise the parts wouldn't be in a group.
|
|
|
| Report Abuse |
|
thebayou
|
  |
| Joined: 21 Dec 2014 |
| Total Posts: 628 |
|
|
| 02 Feb 2017 06:15 PM |
Did you name things right?
Do wait for child
INDENT BETTER PLEASE T_T
|| THEBAYOU || --- FUTURE FAMOUS GUY |
|
|
| Report Abuse |
|
| |