Help with dual wield welding being weird

Hello!
I was working on a tool script, and as always, it was bugged.
I made a script that basically makes it so when you equip the tool, it changes the position of a handle to match the position of the left arm.

However, if you’re moving and you equip the tool, the rotation and position ends up flying itself out of a window and completely bugs out.

If you dont know what I mean, if you are moving and you equip the tool, it ends up going ontop of your shoulders instead of inside your hand.

Heres my script:

	local handle2 = tool.Handle2

	if tool.Parent:FindFirstChild("Left Arm") then
		handle2.Position = tool.Parent["Left Arm"].Position + Vector3.new(0, -1, -0.2)
		handle2.Orientation = tool.Parent["Left Arm"].Orientation + Vector3.new(-90, 0, 0)

		local weld = Instance.new("WeldConstraint")

		weld.Parent = tool.Parent["Left Arm"]
		weld.Part0 = tool.Parent["Left Arm"]
		weld.Part1 = handle2
	end

Any help is appreciated.

try welding it before setting the position. Not sure if that would work tho

I would try to go with CFrames instead of using position; although with CFrame you may have to use the offset value of the weld. For example:

handle2.CFrame= tool.Parent["Left Arm"].CFrame

local offsetCFrame = CFrame.new(Vector3.new(0,-1,-0.2))

weld.C0 = offsetCFrame*CFrame.Angles(math.rad(90),0,0)

It works, thank you so much!!!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.