User:Anaminus/Script:Welder: Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>Anaminus
No edit summary
 
>Anaminus
(Blanked the page)
 
Line 1: Line 1:
<pre>
function glue(x, y)
weld = Instance.new("Weld")


weld.Part0 = x
weld.Part1 = y
local HitPos = x.Position
local CJ = CFrame.new(HitPos)
local C0 = x.CFrame:inverse() *CJ
local C1 = y.CFrame:inverse() * CJ
weld.C0 = C0
weld.C1 = C1
weld.Parent = x
end
local core = script.Parent
local parts = script.Parent.Parent:FindFirstChild(core.Name):GetChildren()
for i=1,#parts do
glue(parts[i], core)
end
print("Welding done")
script.Parent = nil
</pre>

Latest revision as of 02:17, 5 May 2012