RaTheKush
|
  |
| Joined: 12 Dec 2014 |
| Total Posts: 1978 |
|
|
| 07 Oct 2017 04:53 AM |
| How can you check if any parents of a part like the model its in equal a string only if the model exist tho so it doesn't return nil |
|
|
| Report Abuse |
|
|
RaTheKush
|
  |
| Joined: 12 Dec 2014 |
| Total Posts: 1978 |
|
|
| 07 Oct 2017 04:59 AM |
Like this if Target ==x or Target.Parent.Name ==x or Target.Parent.Parent.Name ==x
without attempt to index field 'Parent' (a nil value) |
|
|
| Report Abuse |
|
|
|
| 07 Oct 2017 05:12 AM |
Your explanation is worse than what I ever answered and my answers are like those of a braindead (censored beverage drinker).
While trying to decrypt this enigmatic code, I managed to come up with 2 possible answers.
1 The parent value cannot be a string.
2 if Part.Parent then--checks if the parent value is not equal to nil
end |
|
|
| Report Abuse |
|
|
RaTheKush
|
  |
| Joined: 12 Dec 2014 |
| Total Posts: 1978 |
|
|
| 07 Oct 2017 07:54 AM |
| lol just trying to check if the model or models parent name equals a text |
|
|
| Report Abuse |
|
|
|
| 07 Oct 2017 08:09 AM |
| Oh, if model.Name==Text or model.Parent.Name==Text then |
|
|
| Report Abuse |
|
|
amanda
|
  |
| Joined: 21 Nov 2006 |
| Total Posts: 5925 |
|
|
| 07 Oct 2017 08:58 AM |
if target.Name == x or target:FindFirstAncestor(x) then
end |
|
|
| Report Abuse |
|
|
|
| 07 Oct 2017 09:44 AM |
| Though he only wants the model's and the model parent's name. |
|
|
| Report Abuse |
|
|
amanda
|
  |
| Joined: 21 Nov 2006 |
| Total Posts: 5925 |
|
|
| 07 Oct 2017 09:58 AM |
| Using his second post as reference, it appeared he wanted the whole chain, but was stopped by not knowing how many parents an object had, and getting an error. |
|
|
| Report Abuse |
|
|
LaeMVP
|
  |
| Joined: 24 Jun 2013 |
| Total Posts: 4416 |
|
|
| 07 Oct 2017 09:59 AM |
| model:FindFirstAncestor(name) |
|
|
| Report Abuse |
|
|