|
| 04 Jul 2014 03:13 PM |
I wrote the code
door = script.Parent.Parent.Door door2 = script.Parent.Parent.Door2 function onTouched(hit) door.CanCollide = false door2.CanCollide = false wait(1) door.CanCollide = true door2.CanCollide = true end script.Parent.Touched:connect(onTouched)
I have two of these doors in my world, one of them works, but one doesn't, the code is exactly the same, and the names of the doors are exactly the same, which are Door, and Door2, which i have references to in line 1 but doesn't open, when i start up my world to test it, i receive this error:
16:04:01.269 - Door is not a valid member of Model 16:04:01.270 - Script 'Workspace.Runner Door 1.Door .Script', Line 1 16:04:01.272 - Stack End
In line one, the game is not recognizing "Door" as part of the model Runner Door 1, even though the other door works without a hitch.
If anyone can help me with this, i would be very gratefull
Thanks! |
|
|
| Report Abuse |
|
|
FizBloxx
|
  |
| Joined: 18 Jan 2014 |
| Total Posts: 95 |
|
|
| 04 Jul 2014 03:14 PM |
Check your variable Directory may be wrong |
|
|
| Report Abuse |
|
|
|
| 04 Jul 2014 03:18 PM |
| I checked my variable, the code is exactly the same to the one that works, the doors are named the same as well, Door and Door2, so i would expect the same to happen to the other door as well, but it doesn't |
|
|
| Report Abuse |
|
|
FizBloxx
|
  |
| Joined: 18 Jan 2014 |
| Total Posts: 95 |
|
|
| 04 Jul 2014 03:19 PM |
and what is script.Parent? The door? Or the model?
Btw, first door, is it named "Door" or "Door1" |
|
|
| Report Abuse |
|
|
|
| 04 Jul 2014 03:23 PM |
| The first door is named door, script.Parent represents the block the script is held in, which would be Door, and then script.Parent.Parent represents the Model the doors are contained in, and then the script looks in the model for the part "Door". |
|
|
| Report Abuse |
|
|
FizBloxx
|
  |
| Joined: 18 Jan 2014 |
| Total Posts: 95 |
|
|
| 04 Jul 2014 03:24 PM |
Sometimes scripts load faster than models Add this in the start of your script
repeat wait() until script.Parent.Parent.Door repeat wait() until script.Parent.Parent.Door2 |
|
|
| Report Abuse |
|
|
|
| 04 Jul 2014 03:31 PM |
That didn't work, same error message appeared, telling me that door wasn't valid part of model in the same line of code
16:30:42.275 - Door is not a valid member of Model 16:30:42.276 - Script 'Workspace.Runner Door 1.Door .Script', Line 1
this time i think it resolved the issue before, but created one in the repeat wait() lines |
|
|
| Report Abuse |
|
|
|
| 04 Jul 2014 03:51 PM |
| Thanks for your help, after spending an hour looking for problems i figured out there was a space after Door, therefor making Door without a space an invalid member of model |
|
|
| Report Abuse |
|
|