tahu157
|
  |
| Joined: 16 Nov 2008 |
| Total Posts: 15045 |
|
|
| 05 Mar 2014 10:53 AM |
I am trying to write this script that deletes one part if it comes into contact with a specified other part. This is what I have, and it seems like it should work, but it doesn't and Output doesn't give me anything either:
ObjectA = script.Parent.Torso ObjectB = script.Parent.GoTo
function onTouch(ObjectA) if (ObjectB ~= nil) then ObjectB:Destroy() end end
ObjectA.Touched:connect(onTouch)
|
|
|
| Report Abuse |
|
|
|
| 05 Mar 2014 10:56 AM |
ObjectA = script.Parent.Torso ObjectB = script.Parent.GoTo
function onTouch() if ObjectB ~= nil then ObjectB:Destroy() end end
ObjectA.Touched:connect(onTouch) |
|
|
| Report Abuse |
|
|
|
| 05 Mar 2014 10:57 AM |
| BTW,anything that touchs it will make objectB destroy.. |
|
|
| Report Abuse |
|
|
tahu157
|
  |
| Joined: 16 Nov 2008 |
| Total Posts: 15045 |
|
|
| 05 Mar 2014 10:59 AM |
Still doesn't work.
Thanks though. |
|
|
| Report Abuse |
|
|
tahu157
|
  |
| Joined: 16 Nov 2008 |
| Total Posts: 15045 |
|
|
| 05 Mar 2014 11:00 AM |
| I think I just thought of a workaround that doesn't require the two parts come into contact. |
|
|
| Report Abuse |
|
|
| |
|
tahu157
|
  |
| Joined: 16 Nov 2008 |
| Total Posts: 15045 |
|
|
| 05 Mar 2014 11:05 AM |
| Yeah. Like I said, it doesn't give me any errors. |
|
|
| Report Abuse |
|
|
Kingmouli
|
  |
| Joined: 28 Sep 2012 |
| Total Posts: 1292 |
|
|
| 05 Mar 2014 11:07 AM |
ObjectA = script.Parent.Torso ObjectB = script.Parent.GoTo
function onTouch(thingThatHit) if thingThatHit == ObjectB then ObjectB:Destroy() end end
ObjectA.Touched:connect(onTouch)
I never thought I'd see you on SH Tahu, did BH get boring? |
|
|
| Report Abuse |
|
|
tahu157
|
  |
| Joined: 16 Nov 2008 |
| Total Posts: 15045 |
|
|
| 05 Mar 2014 11:20 AM |
I think everything is working perfectly expect for the :Destroy() part. I tried putting that in another place that I know works, and ObjectB still didn't disappear. Still no Output errors either.
And, nah. I still help out on BH a lot. I've just been trying to make an actual game as opposed to a build job. I'm not a great scripter, so I have to come here every now and again for help. |
|
|
| Report Abuse |
|
|