sumox567
|
  |
| Joined: 22 Apr 2008 |
| Total Posts: 11191 |
|
|
| 17 May 2015 11:07 PM |
local Switch = script.Parent
function onTouch(part) if part.Name == ("Input")then local Door=Switch.Parent.Door Door.Transparency=1 Door.CanCollide=false wait(10) Door.Transparency=0 Door.CanCollide=true end end
Switch.Touched:connect(onTouch)
Switch and Door are both part of one model. When input touches the switch, the door should open. Any thoughts? |
|
|
| Report Abuse |
|
|
amanda
|
  |
| Joined: 21 Nov 2006 |
| Total Posts: 5925 |
|
|
| 17 May 2015 11:10 PM |
| I would assume you are getting an error. What's the output say? |
|
|
| Report Abuse |
|
|
sumox567
|
  |
| Joined: 22 Apr 2008 |
| Total Posts: 11191 |
|
| |
|
mycheeze
|
  |
| Joined: 27 Jun 2011 |
| Total Posts: 6748 |
|
|
| 17 May 2015 11:11 PM |
local Switch = script.Parent
Switch.Touched:connect(function(P) if P.Name == 'Input' then print'Working' local Door = Switch.Parent.Door Door.Transparency = 1 Door.CanCollide = false wait(10) Door.Transparency = 0 Door.CanCollide = true end end) If it prints 'Working' it should be w0rking m8
if it isn't, I blame the Name argument |
|
|
| Report Abuse |
|
|
|
| 17 May 2015 11:12 PM |
This is wrong: if part.Name == ("Input")then
This is correct: if part.Name == "Input" then |
|
|
| Report Abuse |
|
|
amanda
|
  |
| Joined: 21 Nov 2006 |
| Total Posts: 5925 |
|
|
| 17 May 2015 11:13 PM |
Do you have a tool named Input?
If so that's likely your problem, because if you are holding it, then what's actually touching the switch will be called "Handle"
If that is the case, try this:
local Switch = script.Parent
function onTouch(part) if part.Parent.Name == ("Input") then local Door=Switch.Parent.Door Door.Transparency=1 Door.CanCollide=false wait(10) Door.Transparency=0 Door.CanCollide=true end end
Switch.Touched:connect(onTouch) |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 17 May 2015 11:16 PM |
local Switch = script.Parent local Door = script.Parent.Parent.Door
function onTouch(part) if part.Name == "Input" then Door.Transparency = 1 Door.CanCollide = false wait(10) Door.Transparency = 0 Door.CanCollide = true end end
Switch.Touched:connect(onTouch) |
|
|
| Report Abuse |
|
|
sumox567
|
  |
| Joined: 22 Apr 2008 |
| Total Posts: 11191 |
|
| |
|
mycheeze
|
  |
| Joined: 27 Jun 2011 |
| Total Posts: 6748 |
|
|
| 17 May 2015 11:22 PM |
If it doesn't work, we blame your script function.
Please come back when you have an actual error so we aren't embarking on a wild goose chase trying to help an ugly shaggy with a problem we can't solve.
Much love your dragoness <3 |
|
|
| Report Abuse |
|
|
sumox567
|
  |
| Joined: 22 Apr 2008 |
| Total Posts: 11191 |
|
|
| 17 May 2015 11:24 PM |
Hm, fixed on its own, thanks guys, but not sure what was wrong.
thank you for the help though! |
|
|
| Report Abuse |
|
|
sumox567
|
  |
| Joined: 22 Apr 2008 |
| Total Posts: 11191 |
|
|
| 17 May 2015 11:25 PM |
@cheeze
thats a little bit rude, don't you think? |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
| |
|
|
| 17 May 2015 11:29 PM |
| No that wasn't rude, it was the truth. |
|
|
| Report Abuse |
|
|