opplo
|
  |
| Joined: 09 Dec 2008 |
| Total Posts: 5320 |
|
|
| 26 Jun 2014 08:30 AM |
So basically I'm trying to make the ray ignore certain objects. I have 2 models that I want the ray to ignore so I've made a table for each model then put that in an overall table for the ray to ignore. So for example
tab1 = game.Workspace.Model1:getChildren() tab2 = game.Workspace.Model2:getChildren()
tab_ignore = {tab1,tab2}
raymain = game.Workspace:FindPartOnRay(Ray.new(startpos,vec*length),tab_ignore)
However this returns an error in the output "Unable to cast Value to Object" for the findpartonray line.
Anybody help please? :) |
|
|
| Report Abuse |
|
|
Bebee2
|
  |
| Joined: 17 May 2009 |
| Total Posts: 3985 |
|
|
| 26 Jun 2014 08:33 AM |
local tab = {} local tab1 = workspace.Model1:children() local tab2 = workspace.Model2:children()
for _,v in next,tab1 do if v:IsA'BasePart' then table.insert(tab,v) end
for _,v in next, tab2 do if v:IsA'BasePart' do table Insert(tab,v) end
Then you use tab. |
|
|
| Report Abuse |
|
|
opplo
|
  |
| Joined: 09 Dec 2008 |
| Total Posts: 5320 |
|
|
| 26 Jun 2014 08:34 AM |
Thanks, I thought that might be the way to do it.
|
|
|
| Report Abuse |
|
|
opplo
|
  |
| Joined: 09 Dec 2008 |
| Total Posts: 5320 |
|
|
| 26 Jun 2014 08:57 AM |
Any idea why I'm getting this error for your method?
attempt to call field 'Insert' a nil value
for _,u in next, tab2 do if u:IsA'BasePart' then table.Insert(ignorelist,u) end end |
|
|
| Report Abuse |
|
|
Bebee2
|
  |
| Joined: 17 May 2009 |
| Total Posts: 3985 |
|
|
| 26 Jun 2014 09:00 AM |
table.Insert
into
table.insert
Autocorrect loves to do that.
|
|
|
| Report Abuse |
|
|
opplo
|
  |
| Joined: 09 Dec 2008 |
| Total Posts: 5320 |
|
|
| 26 Jun 2014 09:10 AM |
What a troll.
The ol' unable to cast value to Object has returned. |
|
|
| Report Abuse |
|
|
Bebee2
|
  |
| Joined: 17 May 2009 |
| Total Posts: 3985 |
|
| |
|
opplo
|
  |
| Joined: 09 Dec 2008 |
| Total Posts: 5320 |
|
|
| 26 Jun 2014 09:24 AM |
| I used FindPartOnRayWithIgnoreList and it works now :) |
|
|
| Report Abuse |
|
|