Weld all the children of a model to player

Perhaps this example will be a lot more clearer.

Create an attachment between the parts you want to weld, such as a sword and hand in the R15 I will be using the “RightGripAttachment” within.

Use this script to connect the two together in the same place

local dummy = script.Parent
local swordAttachment = workspace.ClassicSword.Handle.Attachment

local rightGrip = dummy.RightHand.RightGripAttachment

local rigidConstraint = Instance.new("RigidConstraint")

rigidConstraint.Attachment0 = rightGrip
rigidConstraint.Attachment1 = swordAttachment

rigidConstraint.Parent = workspace

Now the point I was trying to highlight, you can even use welds as well which have the same CFrame math and function basically the same:

local dummy = script.Parent
local swordAttachment = workspace.ClassicSword.Handle.Attachment

local rightGrip = dummy.RightHand.RightGripAttachment

--local rigidConstraint = Instance.new("RigidConstraint")

--rigidConstraint.Attachment0 = rightGrip
--rigidConstraint.Attachment1 = swordAttachment

--rigidConstraint.Parent = workspace

--This time use welds instead
local weld = Instance.new("Weld")
--Part 0 = the handle and the CFrame of the attachment inside the handle
weld.Part0 = workspace.ClassicSword.Handle
weld.C0 = swordAttachment.CFrame

weld.Part1 = dummy.RightHand
weld.C1 = rightGrip.CFrame

weld.Parent = workspace

Once you press run it will weld in the correct position and orientation.

This will also work if you are welding an assembly (An assembly is a model of parts welded together which acts as one part)

Sword with a brick for example

Running the script will weld the model as intended

If you want to change the position and orientation of the welding you can simply rotate and place the attachments in a different spot. You can also create these attachments via script as well if they don’t exist in the first place.

here is the place file for reference:

WeldingExamplePlace.rbxl (51.6 KB)

4 Likes