Pretty self explanatory, just need to know how to weld objects specifically on an R6 character’s left hand, as in the end of the left arm. I’m not very knowledgeable on CFrame
so I don’t really know how Weld.C0
or Weld.C1
work.
I have searched up on this topic many times before but I’ve never found a solution. Might be searching with the wrong keywords.
local object = part
local hand = left_hand
local weld = Instance.new("Motor6D",hand)
weld.Name = "Part_Weld"
weld.Part0 = hand
weld.Part1 = object
This simply welds the object to the hand, so the object rotates and move according to the hand
Well, yea. The weld worked.
My problem is the positioning.
Also;
local hand = left_hand
I don’t exactly know what this could be referencing, but I am using R6 so it should be Player.Character["Left Arm"]
or something like that.
Yes
So to position it correctly make sure all the parts in the tool are welded to a BasePart and all the parts are Unanchored and now the BasePart will be Part1 of the Weld
EDIT 12/03/2021: Use RigidConstraints to snap accessories together by their attachments instead.
R6 rigs, like R15 rigs, have attachments in their arms respectively named “xGripAttachment”. You can add an attachment to your object’s holding point with preferably the same name and then weld those two parts together but snap them by their attachments’ CFrames.
local accessoryWeld = Instance.new("Weld")
accessoryWeld.Name = "AccessoryWeld"
accessoryWeld.Part0 = YOUR_ACCESSORY_HANDLE
accessoryWeld.Part1 = LIMB_TO_ATTACH_TO
accessoryWeld.C0 = accessoryWeld.Part0.ATTACHMENT_NAME.CFrame
accessoryWeld.C1 = accessoryWeld.Part1.ATTACHMENT_NAME.CFrame
accessoryWeld.Parent = accessoryWeld.Part0
This is code I took from a reply based on accessories so it follows accessory conventions but it should likewise still work for your use case. Just make some adjustments:
- YOUR_ACCESSORY_HANDLE is the part in your object that hosts the grip attachment.
- LIMB_TO_ATTACH_TO should be Left Arm, as per R6 convention.
- ATTACHMENT_NAME, both cases, should be changed to LeftGripAttachment.
Naturally with the last one that also means the attachment you add to your object should be named LeftGripAttachment and should ideally, after being welded, line up with the attachment in the character’s left arm. See this post for more information:
If your object has multiple parts, it should go without saying that they all need to be unanchored and welded together. Additionally, it might do you well to make the parts massless and non-collidable so the total mass of the object doesn’t affect the way the character moves.
But if we use Motors then we can also have more dynamic animations right so why use Welds instead?
You don’t have to use welds, you can change the created weld to a Motor6D if your use case calls for that and the code will work the same. Motor (and therefore Motor6D by right of inheritance) and Weld both inherit from JointInstance. Welds are for rigid joints, motors are for movable joints.
Thank you! It… kind of works.
Do you know why it messes with the right arm like that?
This is my script:
local syringeClone = syringe:Clone()
syringeClone.Parent = game.Workspace
local weld = Instance.new("Weld", syringeClone)
weld.Name = "syringeWeld"
weld.Part0 = syringeClone
weld.Part1 = char:WaitForChild("Left Arm")
weld.C0 = weld.Part0.LeftGripAttachment.CFrame
weld.C1 = weld.Part1.LeftGripAttachment.CFrame
That’s interesting. Is it this specific piece of code that’s messing with the arm? The only thing I’d personally recommend is parenting the weld after you set its properties. If you set an instance’s properties then you should never use the second argument of Instance.new.
local syringeClone = syringe:Clone()
syringeClone.Parent = game.Workspace
local weld = Instance.new("Weld")
weld.Name = "syringeWeld"
weld.Part0 = syringeClone
weld.Part1 = char:WaitForChild("Left Arm")
weld.C0 = weld.Part0.LeftGripAttachment.CFrame
weld.C1 = weld.Part1.LeftGripAttachment.CFrame
weld.Parent = syringeClone
Would be helpful to know if it’s this specific piece of code that you have in that’s started making this happen or if you modify any welds anywhere else.
I assume it’s the syringe model itself, I’ll just mess around and see what fixes it. Thank you!
You should recheck the animation, it maybe the animation that’s doing it