Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Welding ROBLOX weapons, parts scattered around the map?

Hi SH,

I've made and scripted an AWP for a game I have in mind, but on usage, (mind you, it's fully welded) I see some parts are missing, and they're scattered around the baseplate. I don't know if it's a failure of my Weld Script, or anything.

This is my weld script:

function Weld(x,y)
 local W = Instance.new("Weld")
 W.Part0 = x
 W.Part1 = y
 local CJ = CFrame.new(x.Position)
 local C0 = x.CFrame:inverse()*CJ
 local C1 = y.CFrame:inverse()*CJ
 W.C0 = C0
 W.C1 = C1
 W.Parent = x
end

function Get(A)
 if A.className == "Part" then
  Weld(script.Parent.Handle, A)
  A.Anchored = false
 else
  local C = A:GetChildren()
  for i=1, #C do
  Get(C[i])
  end
 end
end

function Finale()
 Get(script.Parent)
end

script.Parent.Equipped:connect(Finale)
script.Parent.Unequipped:connect(Finale)
Finale()

I don't know what I'm doing wrong. Help?

3 comments

0

Make sure the Weapon is not Anchored and doesn;t collide.

0

The script actually welds colliding objects, so that is not the problem.

0

With ROBLOX's release of Solid Modeling, especially now that the collision is better, it is usually preferable to make tools and such a single part until of welding multiple parts.

2 answers

This has been solved. I installed Ozzypig's welding plugin and it did the job just fine, now I have CFramed weapons.

Use solid modeling now, rather than using hundreds of parts. Your players will appreciate the lag reduction.

This discussion is preserved as it was. New answers, comments, and votes are closed.