drmiewlo
|
  |
| Joined: 14 Mar 2012 |
| Total Posts: 1782 |
|
|
| 01 Feb 2012 04:26 PM |
I have a dewelding script that works when you put it into a model in the workspace, but for some reason it doesn't work when I put it inside of a tool(I've tried using a script and a local script.) I've tried putting a local script and script into the starterpack that removes the welds once the tool is added, but that doesn't work either. Anyone know how I could remove the welds that are inside of the tool once it is unequipped? Here's what I have so far:
script.Parent.Unequipped:connect(function(mouse)
stuff = script.Parent:GetChildren() for i=1,#stuff do if stuff[i]:IsA("BasePart") then stuf = stuff[i]:GetChildren() for b=1,#stuf do if stuf[b].ClassName == "Weld" then stuf[b]:Destroy() end end end end
end)
~drmiewlo |
|
|
| Report Abuse |
|
|
drmiewlo
|
  |
| Joined: 14 Mar 2012 |
| Total Posts: 1782 |
|
| |
|
drmiewlo
|
  |
| Joined: 14 Mar 2012 |
| Total Posts: 1782 |
|
|
| 01 Feb 2012 08:11 PM |
Do scripts just not work in the backpack?
~drmiewlo |
|
|
| Report Abuse |
|
|
|
| 01 Feb 2012 08:13 PM |
| So you want to remove all the welds, within a tool? |
|
|
| Report Abuse |
|
|
|
| 01 Feb 2012 08:13 PM |
script.Parent.Unequipped:connect(function(mouse) for i, v in pairs(script.Parent:GetChildren()) do if v:IsA("Tool") then v:Destroy() end end end)
Like this?
† KMXD † |
|
|
| Report Abuse |
|
|
|
| 01 Feb 2012 08:15 PM |
Ehh, sorry didn't read everything :o
script.Parent.Unequipped:connect(function(mouse) for i, v in pairs(script.Parent:GetChildren()) do if v:IsA("Tool") then for a, b in pairs(v:GetChildren()) if b:IsA("Weld") then b:Remove() end end end end)
Idk, try?
† KMXD † |
|
|
| Report Abuse |
|
|
|
| 01 Feb 2012 08:23 PM |
| Knight, you forgot a the do, on your for loop, and your missing an end...tired? |
|
|
| Report Abuse |
|
|
| |
|
|
| 01 Feb 2012 09:00 PM |
Also, for thread creator, here is the fixed script:
script.Parent.Unequipped:connect(function(mouse) for i, v in pairs(script.Parent:GetChildren()) do if v:IsA("Tool") then for a, b in pairs(v:GetChildren()) do if b:IsA("Weld") then b:Remove() end end end end end) |
|
|
| Report Abuse |
|
|
drmiewlo
|
  |
| Joined: 14 Mar 2012 |
| Total Posts: 1782 |
|
|
| 02 Feb 2012 03:42 PM |
Didn't work. I honestly have no clue what is wrong with it; I tried putting it in a regular script and a local script inside of the tool.
~drmiewlo |
|
|
| Report Abuse |
|
|
|
| 02 Feb 2012 03:55 PM |
| Use :ClearAllChildren() on the Backpack. |
|
|
| Report Abuse |
|
|
drmiewlo
|
  |
| Joined: 14 Mar 2012 |
| Total Posts: 1782 |
|
|
| 02 Feb 2012 06:12 PM |
I only want to remove the welds, there are meshes in the parts also.
~drmiewlo |
|
|
| Report Abuse |
|
|