Kasumo
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 2467 |
|
|
| 22 Jun 2013 12:30 PM |
local swo = script.Parent local x = Instance.new("Weld") x.Parent = swo x.Part0 = swo.Sword x.Part1 = swo.RightArm
--Would this be right? Can't weld very good. |
|
|
| Report Abuse |
|
|
|
| 22 Jun 2013 12:40 PM |
function weld(part0,part1,c1) local weld = Instance.new("Weld",part0) for n,o in pairs({C1=c1,Part0=part0,Part1=part1})do weld[n] = o end return weld end
local w = weld(Workspace.A,Workspace.B,CFrame.new(0,0,-1))
Mess with this.
donut first, answer later |
|
|
| Report Abuse |
|
|
|
| 22 Jun 2013 12:41 PM |
function weld(part0,part1,c1) local weld = Instance.new("Weld",part0) for n,o in pairs({C1=c1,Part0=part0,Part1=part1})do weld[n] = o end return weld end swo = script.Parent local w = weld(swo.Sword,swo.RightArm,CFrame.new(0,0,-1))
Mess with this.
donut first, answer later |
|
|
| Report Abuse |
|
|
Kasumo
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 2467 |
|
| |
|
compy111
|
  |
| Joined: 02 Apr 2009 |
| Total Posts: 583 |
|
|
| 22 Jun 2013 01:22 PM |
I often use this as a Weld script.
arm = ......... handle = ...........
local W = Instance.new("Weld") W.Part0 = handle W.Part1 = arm local CJ = CFrame.new(handle.Position) local C0 = handle.CFrame:inverse()*CJ local C1 = arm.CFrame:inverse()*CJ W.C0 = C0 W.C1 = C1 W.Parent = handle
I also often use this one. This script welds all objects with ClassName 'part' that are grouped with the script.
weldto = script.Parent.weldto
C = script.Parent:GetChildren() for i = 1, #C do if C[i].ClassName == 'Part' then local W = Instance.new("Weld") W.Part0 = C[i] W.Part1 = weldto local CJ = CFrame.new(C[i].Position) local C0 = C[i].CFrame:inverse()*CJ local C1 = weldto.CFrame:inverse()*CJ W.C0 = C0 W.C1 = C1 W.Parent = C[i] C[i].Anchored = false end end |
|
|
| Report Abuse |
|
|
darkero99
|
  |
| Joined: 11 Mar 2011 |
| Total Posts: 399 |
|
|
| 22 Jun 2013 02:14 PM |
@^
We have the same, except I use different variables. |
|
|
| Report Abuse |
|
|