nhanbin03
|
  |
| Joined: 10 May 2016 |
| Total Posts: 16 |
|
|
| 30 Sep 2016 09:46 PM |
| How can I open and close door with only one button? |
|
|
| Report Abuse |
|
|
|
| 30 Sep 2016 10:29 PM |
add a bool value into the script and name it Open
function Click() if script.Open = false then --script script.Open.Value == true
else
script.Open.Value == false end end script.Parent.ClickDetector.MouseClick:connect(Click)
Just athought? |
|
|
| Report Abuse |
|
|
|
| 30 Sep 2016 10:30 PM |
first step, rename your button in the workspace to "button" and also rename the door you want to "door" you must also insert the script into this one as well. second step, right click on the "button" and hit Insert Object. Use the ClickDetector object.
just as a side note, you must adjust the locations accordingly meaning if you have them in a model you must address them differently.
button = script.Parent door = game.Workspace.door
function onClicked(button) if door.CanCollide == true then door.CanCollide = false door.Transparency = 0 else door.Transparency = 1 door.CanCollide = true end end
script.Parent.ClickDetector.mouseClick:connect(onClicked)
|
|
|
| Report Abuse |
|
|
|
| 30 Sep 2016 10:37 PM |
oops, switch the 0 and the 1 around btw, my mistake.
|
|
|
| Report Abuse |
|
|
nhanbin03
|
  |
| Joined: 10 May 2016 |
| Total Posts: 16 |
|
|
| 01 Oct 2016 12:30 AM |
OMG thank you very much!!!!
That helps me a lot XD
|
|
|
| Report Abuse |
|
|