VoltiCoil
|
  |
| Joined: 20 Nov 2008 |
| Total Posts: 1227 |
|
|
| 13 Feb 2014 04:09 PM |
Hey everyone!
I know how to make a perfect unlockable door, easy, and lock it, easy. However, does anyone know how to script a door so that it unlocks, like it normally would, but then slowly returns back to its original position where it then locks again, shut.
For instance, think of those doors they use for flats, the main doors that use a powerful magnet to lock in place.
I was thinking of using the cframe method so that when the door unlocks, it automatically opens then shuts after a delay, however I want the user to push the door as there wouldn't be an imaginary force pulling it.
Thanks! |
|
|
| Report Abuse |
|
|
VoltiCoil
|
  |
| Joined: 20 Nov 2008 |
| Total Posts: 1227 |
|
| |
|
maxomega3
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 10668 |
|
|
| 13 Feb 2014 04:17 PM |
| http://web.roblox.com/magnets-item?id=130984415 |
|
|
| Report Abuse |
|
|
Azureous
|
  |
| Joined: 29 Jan 2012 |
| Total Posts: 25287 |
|
|
| 13 Feb 2014 04:23 PM |
| This would be way too long and annoying to build so just use those jiggly glued parts and you can run into the door to open it and just anchor it when you want it to be locked. |
|
|
| Report Abuse |
|
|
VoltiCoil
|
  |
| Joined: 20 Nov 2008 |
| Total Posts: 1227 |
|
|
| 13 Feb 2014 04:27 PM |
Ah, that's a point. What do glue parts do though? I have never used them before... |
|
|
| Report Abuse |
|
|
Azureous
|
  |
| Joined: 29 Jan 2012 |
| Total Posts: 25287 |
|
|
| 13 Feb 2014 04:28 PM |
Nevermind…
just use CFrame.Angles and rotate the door model and then when you want it locked reverse the Angle movement and then anchored the parts in the model. |
|
|
| Report Abuse |
|
|
VoltiCoil
|
  |
| Joined: 20 Nov 2008 |
| Total Posts: 1227 |
|
|
| 13 Feb 2014 04:30 PM |
| Yeah, I might as well do that. Thanks anyways. |
|
|
| Report Abuse |
|
|
|
| 13 Feb 2014 04:53 PM |
Hmm assuming I understood what you meant
door = game.Workspace.Door Position = door.Position repeat wait(0.001)--Speed in which it opens door.Position = door.Position + Vector3.new(0,0,0) --Add 0.001 in the axis you wish for it to move until door.Position = Position + Vector3.new(0,0,0) -- Add however many studs you want it to move before it stops, in the correct axis repeat wait(0.005)--Speed in which it closes door.Position = door.Position - Vector3.new(0,0,0) --Add what you put here beforehand here again until door.Position = Position --Feel free to adjust the speed --[[I believe this should work, now assuming you have the ability to put it in a function of the situation you want, for example this is what it would be in a touch function:
door = game.Workspace.Door--The door function touch() Position = door.Position repeat wait(0.001)--Speed in which it opens door.Position = door.Position + Vector3.new(0,0,0) --Add 0.001 in the axis you wish for it to move until door.Position = Position + Vector3.new(0,0,0) -- Add however many studs you want it to move before it stops, in the correct axis repeat wait(0.005)--Speed in which it closes door.Position = door.Position - Vector3.new(0,0,0) --Add what you put here beforehand here again until door.Position = Position --Feel free to adjust the speed end door.Touched:connect(touch)
--So put it inside the proper fuction for you! |
|
|
| Report Abuse |
|
|
|
| 13 Feb 2014 04:56 PM |
| Replace fuction in the end with function, and at the very last line put --]] then you can just keep the comments if you wish! Sorry about that! |
|
|
| Report Abuse |
|
|