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: Lockable Doors

Previous Thread :: Next Thread 
VoltiCoil is not online. 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 is not online. VoltiCoil
Joined: 20 Nov 2008
Total Posts: 1227
13 Feb 2014 04:16 PM
Anyone?
Report Abuse
maxomega3 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
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
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
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
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