How to weld a part to another?

Hello I have this gun and it has 2 grips. These grips are where I want the hands to be holding the gun. The first grip is the trigger and the second is the end of the gun. Is it possible to do some math to automatically position the gun to move in a orientation and position where the gun moves in the character at a position where both grips of the gun are being touched by the correct hand? I’m doing this so it’s easier to animate. Right now, my system is a little out of control

Here’s my code:

	local gun = game.ServerStorage.Model:Clone()
	gun.Parent = plr.Character
	local HandRightWeld ="WeldConstraint")
	local HandLeftWeld ="WeldConstraint")
	local RightHand = nil
	local LeftHand = nil
	if plr.Character:FindFirstChild("Right Arm") then
		RightHand = plr.Character:FindFirstChild("Right Arm")
		LeftHand = plr.Character:FindFirstChild("Light Arm")
	elseif plr.Character:FindFirstChild("RightHand") then
		RightHand = plr.Character:FindFirstChild("RightHand")
		LeftHand = plr.Character:FindFirstChild("LeftHand")
		error("something went wrong")
	HandRightWeld.Parent = RightHand
	HandRightWeld.Part0 = RightHand
	HandRightWeld.Part1 = gun.Hand1
	HandRightWeld.Parent = LeftHand
	HandRightWeld.Part0 = LeftHand
	HandRightWeld.Part1 = gun.Hand2

Is it possible to do some math to be able to position the gun grips to always be connected to the arms?
see how the arm is outstretched to this handle peice. Is it possible to make it so both gun grips are always touching the arm in the correct spot? For example
this way I will be able to animate the characters arms and the gun will follow the animation automaticacly


I advise changing somewhere along the Grip direction located in Properties of Appearance to which desired orientation of how you want your gear to face.

  • GripForward
  • GripPos
  • GripRight
  • GripUp

Another method is using the Tool Grip Editor plugin which is more easier but cost Robux.


It’s not a tool, it’s a model. I don’t want to use Roblox’s ugly tool system


You need to use gun:GetPivot().Position (assuming it’s a model), which will get its position. Then you would be able to use PivotTo.

If that does not work, try this instead


Otherwise, you might have to resort into :SetPrimaryPartCFrame()

1 Like