Sharpthy
|
  |
| Joined: 18 Jan 2014 |
| Total Posts: 57 |
|
|
| 14 Jun 2015 08:08 AM |
My door script does not work. I don't know why. I need someone to help me, and once that is done, I also need to change the door opening speed! Thanks for the help:
local DoorOpen = 0 --0 = Closed, 1 = Open. local InUse = 0 --0 = Active, 1 = Still. function onClicked() if DoorOpen == 0 then if InUse = 0 then --Open the doors! InUse = 1 DoorOpen = 1 Door.CFrame = CFrame.new(-141, 6.5, 120) InUse = 0 else --Close the doors! InUse = 1 DoorOpen = 0 Door.CFrame = CFrame.new(-141,6.5, 152) InUse = 0 end end model.button.ClickDetector.MouseClick:connect(onClicked) --Open CFrame = -141, 6.5, 120 --Closed CFrame = -141, 6.5, 152 |
|
|
| Report Abuse |
|
|
Sharpthy
|
  |
| Joined: 18 Jan 2014 |
| Total Posts: 57 |
|
|
| 14 Jun 2015 08:14 AM |
File Structure:
Courtyard doors |Courtyard door |Button |ClickDetector |Script
|
|
|
| Report Abuse |
|
|
Sharpthy
|
  |
| Joined: 18 Jan 2014 |
| Total Posts: 57 |
|
|
| 14 Jun 2015 09:33 AM |
I've changed the script a bit:
door = script.parent.CourtyardDoor
local DoorOpen = 0 --0 = Closed, 1 = Open. local InUse = 0 --0 = Active, 1 = Still.
function onClicked (mouse) if DoorOpen == 0 then if InUse == 0 then --Open the doors! print 'Door Opening' InUse = 1 DoorOpen = 1 door.CFrame = CFrame.new(-141, 6.5, 120) InUse = 0 print 'Door Opened' else --Close the doors! print 'Door Closing' InUse = 1 DoorOpen = 0 door.CFrame = CFrame.new(-141,6.5, 152) InUse = 0 print 'Door Closed' end end end script.Parent.ClickDetector.MouseClick:connect(onClicked)
--Open CFrame = -141, 6.5, 120 --Closed CFrame = -141, 6.5, 152 |
|
|
| Report Abuse |
|
|
Sharpthy
|
  |
| Joined: 18 Jan 2014 |
| Total Posts: 57 |
|
| |
|
| |
|
Sharpthy
|
  |
| Joined: 18 Jan 2014 |
| Total Posts: 57 |
|
|
| 14 Jun 2015 01:05 PM |
| Needed to change .parent. to .Parent. |
|
|
| Report Abuse |
|
|