generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: One Way Door Broken, Help!

Previous Thread :: Next Thread 
siriusblack842 is not online. siriusblack842
Joined: 15 Jun 2011
Total Posts: 22
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 is not online. FizBloxx
Joined: 18 Jan 2014
Total Posts: 95
04 Jul 2014 03:14 PM
Check your variable
Directory may be wrong
Report Abuse
siriusblack842 is not online. siriusblack842
Joined: 15 Jun 2011
Total Posts: 22
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 is not online. 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
siriusblack842 is not online. siriusblack842
Joined: 15 Jun 2011
Total Posts: 22
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 is not online. 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
siriusblack842 is not online. siriusblack842
Joined: 15 Jun 2011
Total Posts: 22
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
siriusblack842 is not online. siriusblack842
Joined: 15 Jun 2011
Total Posts: 22
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image