krisk7
|
  |
| Joined: 24 Aug 2013 |
| Total Posts: 254 |
|
|
| 26 Mar 2015 12:41 AM |
So this is a cframe door opening script. This script only activates the door opening script but I was wondering how do I change this into a click activated brick. I tried just changing the touch commands onto click commands but it doesn't work for some reason. So what do I have to do to change this script so it activates when I click it? Here's the script:
local dooropener = script.DoorOpener:Clone() local deb = true
function onTouch(hit) if not deb then return end deb = false local opener = dooropener:Clone() opener.Disabled = false opener.Parent = script.Parent.Parent.Door repeat wait(2) until opener.Parent == nil deb = true end
script.Parent.Button.Touched:connect(onTouch) |
|
|
| Report Abuse |
|
|
krisk7
|
  |
| Joined: 24 Aug 2013 |
| Total Posts: 254 |
|
| |
|
Sypr
|
  |
| Joined: 14 Feb 2013 |
| Total Posts: 556 |
|
|
| 27 Mar 2015 12:03 AM |
i thought i replyed to this
|
|
|
| Report Abuse |
|
|
krisk7
|
  |
| Joined: 24 Aug 2013 |
| Total Posts: 254 |
|
| |
|
|
| 27 Mar 2015 05:48 AM |
local cd = Instance.new('ClickDetector',script.Parent)
local dooropener = script.DoorOpener:Clone() local deb = true
function click() if not deb then return end deb = false local opener = dooropener:Clone() opener.Disabled = false opener.Parent = script.Parent.Parent.Door repeat wait(2) until opener.Parent == nil deb = true end
cd.MouseClick:connect(click)
Septamology - R$344 - Tx1,213 |
|
|
| Report Abuse |
|
|
krisk7
|
  |
| Joined: 24 Aug 2013 |
| Total Posts: 254 |
|
|
| 27 Mar 2015 06:20 PM |
| Now it doesn't work at all. |
|
|
| Report Abuse |
|
|
|
| 27 Mar 2015 06:26 PM |
Well, I tried. Don't be so stubborn, people are actually trying to help you.
Septamology - R$228 - Tx1,649 |
|
|
| Report Abuse |
|
|
krisk7
|
  |
| Joined: 24 Aug 2013 |
| Total Posts: 254 |
|
|
| 27 Mar 2015 06:39 PM |
| Well I've tried to just replace the touch commands to click commands but that doesn't work. I just don't understand how it can work when you touch it but doesn't work when you click it. |
|
|
| Report Abuse |
|
|
|
| 27 Mar 2015 06:41 PM |
Show me the set up you have like:
door -script -other stuff --more stuff |
|
|
| Report Abuse |
|
|
krisk7
|
  |
| Joined: 24 Aug 2013 |
| Total Posts: 254 |
|
|
| 27 Mar 2015 06:48 PM |
-sliding door --model speed --value speed2 --value Door --model door--part Touch --model Script --this is the script that I want to have activated on click DoorOpener --script Button --part |
|
|
| Report Abuse |
|
|
| |
|
krisk7
|
  |
| Joined: 24 Aug 2013 |
| Total Posts: 254 |
|
|
| 27 Mar 2015 07:42 PM |
| Ok it's in my models as a free model. |
|
|
| Report Abuse |
|
|
| |
|
krisk7
|
  |
| Joined: 24 Aug 2013 |
| Total Posts: 254 |
|
|
| 28 Mar 2015 04:50 PM |
| I have a bit of a problem with your door. So what happens is when I click in it it moves however what I want to have happen is for the door to move forward and then wait 2 seconds and then move back to its original position which is does however the problem is if I click on it again and again before it's moved back it keeps moving forward. So bascially I want it to move just once when the player clicks the button and then be unable to move until it moves back to its original position. Would adding debounce help? |
|
|
| Report Abuse |
|
|
krisk7
|
  |
| Joined: 24 Aug 2013 |
| Total Posts: 254 |
|
|
| 28 Mar 2015 04:54 PM |
| Actually nvm. I added debounce and it fixed the problem and now it works prefectly. Thank you very much. |
|
|
| Report Abuse |
|
|
| |
|