salem9
|
  |
| Joined: 25 Oct 2008 |
| Total Posts: 23312 |
|
|
| 18 Jul 2011 10:19 PM |
local Welds = {} local WeldClones = {} local Handle = script.Parent.Handle
for i,v in pairs(script.Parent:GetChildren()) do if v:IsA("BasePart") then if v.Name ~= "Handle" then local w = Instance.new("Weld") w.Part0, w.Part1 = Handle, v w.C1 = w.Part1.CFrame:toObjectSpace(w.Part0.CFrame) w.Parent = Game.JointsService if v.Name == "RightArm" then w.Name = "" ..script.Parent.Parent.. "RightArm" elseif v.Name == "LeftArm" then w.Name = "" ..script.Parent.Parent.. "LeftArm" table.insert(Welds, w) table.insert(WeldClones, w:Clone()) end end end end
script.Parent.Equipped:connect(function() for i,v in pairs(WeldClones) do v:Clone().Parent = Game.JointsService end end)
No output, but when first selected the brick named RightArm doesn't weld, and the second time selected the LeftArm brick doesn't weld. |
|
|
| Report Abuse |
|
|
TimeOF
|
  |
| Joined: 14 Jun 2011 |
| Total Posts: 129 |
|
|
| 18 Jul 2011 10:24 PM |
local Welds = {} local WeldClones = {} local Handle = script.Parent.Handle
for i,v in pairs(script.Parent:GetChildren()) do if v:IsA("BasePart") then if v.Name ~= "Handle" then local w = Instance.new("Weld") w.Part0,Part1 = Handle, v w.C1 = Part1.CFrame:toObjectSpace(Part0.CFrame) w.Parent = Game.JointsService if v.Name == "RightArm" then w.Name = "" ..script.Parent.Parent.. "RightArm" elseif v.Name == "LeftArm" then w.Name = "" ..script.Parent.Parent.. "LeftArm" table.insert(Welds, w) table.insert(WeldClones, w:Clone()) end end end end
script.Parent.Equipped:connect(function() for i,v in pairs(WeldClones) do v:Clone().Parent = Game.JointsService end end)
Not sure but i took a stab in the dark :/ It could be u cant have a variable inside of another variable ((Like so)) Example:w.part,w.part,w.part I dont think that is right but i might be wrong.
|
|
|
| Report Abuse |
|
|
salem9
|
  |
| Joined: 25 Oct 2008 |
| Total Posts: 23312 |
|
|
| 18 Jul 2011 10:33 PM |
| What did you change? I can't find a difference in the two scripts. |
|
|
| Report Abuse |
|
|
TimeOF
|
  |
| Joined: 14 Jun 2011 |
| Total Posts: 129 |
|
|
| 18 Jul 2011 10:47 PM |
| I removed the w. variable that is inside the other w. |
|
|
| Report Abuse |
|
|
salem9
|
  |
| Joined: 25 Oct 2008 |
| Total Posts: 23312 |
|
|
| 18 Jul 2011 10:59 PM |
| That breaks the script. Part1 can't be found since it's heirarchy isn't defined earlier. |
|
|
| Report Abuse |
|
|
salem9
|
  |
| Joined: 25 Oct 2008 |
| Total Posts: 23312 |
|
| |
|