TheMcInc
|
  |
| Joined: 30 Sep 2012 |
| Total Posts: 227 |
|
|
| 06 Jan 2014 07:49 AM |
| Hi, im making a crash disaster game, and I need a script that will unweld certain parts when they are touched by another certain block. If its possible to detect if it has a weld, that would be great! I'll be waiting!!! ;D |
|
|
| Report Abuse |
|
|
|
| 06 Jan 2014 07:53 AM |
for _, v in pairs(model:GetChildren()) do if v.ClassName == "Weld" then v:Destroy() elseif v.ClassName == "Part" then for _, s in pairs(v:GetChildren()) do if s.ClassName == "Weld" then s:Destroy() end end elseif v.ClassName == "Model" then for _, z in pairs(v:GetChildren()) do if z.ClassName == "Weld" then z:Destroy() elseif z.ClassName == "Part" then for _, c in pairs(z:GetChildren()) do if c.ClassName == "Weld" then c:Destroy() end end end end end end
--I could go on for forever but eh. model at the top is da model you want to unweld. Or you can simply do model:BreakJoints() --Derp |
|
|
| Report Abuse |
|
|
TheMcInc
|
  |
| Joined: 30 Sep 2012 |
| Total Posts: 227 |
|
|
| 06 Jan 2014 08:03 AM |
| I guess I'll use model:BreakJoints, considering the model I want to have unweld everything has a ton of parts... Just wondering, how would I use model:BreakJoints? |
|
|
| Report Abuse |
|
|
|
| 06 Jan 2014 08:04 AM |
| You find the model and just do model:BreakJoints() or if your lazy: model:BreakJoints'' |
|
|
| Report Abuse |
|
|
TheMcInc
|
  |
| Joined: 30 Sep 2012 |
| Total Posts: 227 |
|
|
| 06 Jan 2014 08:07 AM |
Could I do:
--Script starts here game.Workspace.ModelName:BreakJoints() --Script ends here
??? |
|
|
| Report Abuse |
|
|
|
| 06 Jan 2014 08:23 AM |
ye
just make sure its not anchored |
|
|
| Report Abuse |
|
|
TheMcInc
|
  |
| Joined: 30 Sep 2012 |
| Total Posts: 227 |
|
| |
|