doneyes
|
  |
| Joined: 21 Mar 2008 |
| Total Posts: 3466 |
|
|
| 28 Jun 2012 09:50 AM |
I'm trying to make a script that deletes any brick named "M" that touches it at any time. Here is what I've got. I'm not good with onTouched so I need some help.
M = script.Parent.Parent.M
function onTouched(hit) if M.Name == "M" then M:Remove() end
script.Parent.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|
| |
|
RoAnt
|
  |
| Joined: 14 Jul 2008 |
| Total Posts: 16794 |
|
|
| 28 Jun 2012 10:15 AM |
local M = script.Parent.Parent.M
M.Touched:connect(function(hit) if hit.Name == "M" then hit:Remove() end end)
I'm not sure what you want... so here. This basically delete any brick that touch the variable M. But! The brick has to be named 'M' |
|
|
| Report Abuse |
|
|
doneyes
|
  |
| Joined: 21 Mar 2008 |
| Total Posts: 3466 |
|
|
| 28 Jun 2012 10:20 AM |
| It still isn't working. I really cant figure this out. |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 28 Jun 2012 10:20 AM |
M = script.Parent.Parent.M
function onTouched(hit) if M.Name == "M" then M:Remove() end end
script.Parent.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|
|
| 28 Jun 2012 10:40 AM |
script.Parent.Touched:connect(function(hit) if not hit.Name == "M" then return end hit:Destroy() end)
This will destroy any bricks named "M" that touched this script's parent. Hopefully that's what you wanted...
> † KMXD † |
|
|
| Report Abuse |
|
|