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: Help with handicap door

Previous Thread :: Next Thread 
jager72 is not online. jager72
Joined: 14 Aug 2010
Total Posts: 11034
21 Aug 2014 08:58 PM
I made a handicap door, but when you click the button, the door opens, but you have to click it again to close it. I need help making it so that after waiting 5 seconds, it closes by itself again. Here is the script:

door = script.Parent.Parent.Union
handicap = script.Parent
open = false

handicap.ClickDetector.MouseClick:connect(function()
if(open == false) then
game.Workspace.RightHandicapDoor.DoorRotation.Part.CFrame= CFrame.new(160.28,7.19, -73.25) * CFrame.Angles(0, math.pi, 0)

game.Workspace.RightHandicapDoor.DoorRotation.Union.CFrame= CFrame.new(160.28, 7.19, -73.25) * CFrame.Angles(0, math.pi/2, 0)
open = true
elseif(open == true) then
game.Workspace.RightHandicapDoor.DoorRotation.Part.CFrame= CFrame.new(158.28, 7.19, -71.25) * CFrame.Angles(0, math.pi/2, 0)
game.Workspace.RightHandicapDoor.DoorRotation.Union.CFrame= CFrame.new(158.28, 7.19, -71.25) * CFrame.Angles(0, math.pi, 0)
open = false
end
end)
Report Abuse
jager72 is not online. jager72
Joined: 14 Aug 2010
Total Posts: 11034
21 Aug 2014 09:00 PM
Sorry, i screwed up the script

here it is
door = script.Parent.Parent.DoorRotation
handicap = script.Parent
open = false

handicap.ClickDetector.MouseClick:connect(function()
if(open == false) then
game.Workspace.RightHandicapDoor.DoorRotation.Part.CFrame= CFrame.new(164.77, 7.39, -66.22) * CFrame.Angles(0, math.pi, 0)
game.Workspace.RightHandicapDoor.DoorRotation.Union.CFrame= CFrame.new(164.77, 7.39, -66.22) * CFrame.Angles(0, math.pi, 0)
open = true
elseif(open == true) then
game.Workspace.RightHandicapDoor.DoorRotation.Part.CFrame= CFrame.new(162.77, 7.39, -64.22) * CFrame.Angles(0, math.pi/2, 0)
game.Workspace.RightHandicapDoor.DoorRotation.Union.CFrame= CFrame.new(162.77, 7.39, -64.22) * CFrame.Angles(0, math.pi/2, 0)
open = false
end
end)
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
21 Aug 2014 09:06 PM
door = script.Parent.Parent.DoorRotation
handicap = script.Parent
open = false

handicap.ClickDetector.MouseClick:connect(function()
if not open then
open = true
game.Workspace.RightHandicapDoor.DoorRotation.Part.CFrame= CFrame.new(164.77, 7.39, -66.22) * CFrame.Angles(0, math.pi, 0)
game.Workspace.RightHandicapDoor.DoorRotation.Union.CFrame= CFrame.new(164.77, 7.39, -66.22) * CFrame.Angles(0, math.pi, 0)
wait(5)
game.Workspace.RightHandicapDoor.DoorRotation.Part.CFrame= CFrame.new(162.77, 7.39, -64.22) * CFrame.Angles(0, math.pi/2, 0)
game.Workspace.RightHandicapDoor.DoorRotation.Union.CFrame= CFrame.new(162.77, 7.39, -64.22) * CFrame.Angles(0, math.pi/2, 0)
open = false
end
end)
Report Abuse
jager72 is not online. jager72
Joined: 14 Aug 2010
Total Posts: 11034
21 Aug 2014 09:12 PM
I've tried that, and it opens the door, but it never closes even if I click the button again.
Report Abuse
ZQFMGB12 is not online. ZQFMGB12
Joined: 07 Aug 2010
Total Posts: 208
21 Aug 2014 09:23 PM
Don't know exactly (because I don't use click detector), but I have found some other problems.
You can replace CFrame.new(x,y,z) with CFrame.new(part.Position) if you plan on having several other doors, so you don't have to constantly type in the door's Position in the script.
I don't know the functions of Part and Union, but at least two parts should be present: A 'hinge' part at the edge of the door and the actual door. The door should be welded to the hinge and only the hinge should rotate.
If you directly change the CFrame, the rotation will be instantaneous. You should use something like BodyGyro instead (only in the hinge part)

I have built doors that open up on contact, forces the player through it (realistically), and then closes.
Report Abuse
ZQFMGB12 is not online. ZQFMGB12
Joined: 07 Aug 2010
Total Posts: 208
21 Aug 2014 09:24 PM
Also, you should have a variable that stores the original CFrame of the door. The door's CFrame should be equal to that variable when the door closes.
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