Making Dual Wielding Sword

  1. What do you want to achieve?
    I want to achieve that when i equip the tool i have 2 katanas 1 in right hand and the other one in the left hand
  2. What is the issue?
    The problem is when i unequip the tool and equip it again then the rotation is not set to what it should to be set to
    https://www.youtube.com/watch?v=lPGsJ5eKIxQ

script im using:

weldgot = true
script.Parent.Changed:Connect(function()
	if script.Parent.Parent:FindFirstChild("Humanoid") and weldgot == true then
		weldgot = false
		script.Parent.Handle1.Handle.Anchored = false
		script.Parent.Handle2.Handle.Anchored = false
		w = Instance.new("Weld", script.Parent)w.Name = "Weld1"
		script.Parent.Handle1.Handle.Rotation = Vector3.new(-90, 180, -90)
		w.Part0 = script.Parent.Parent["RightHand"]
		w.Part1 = script.Parent.Handle1.Handle
		s = Instance.new("Weld", script.Parent)s.Name = "Weld2"
		script.Parent.Handle2.Handle.Rotation = Vector3.new(-90, 180, -90)
		s.Part0 = script.Parent.Parent["LeftHand"]
		s.Part1 = script.Parent.Handle2.Handle
	elseif weldgot == false and script.Parent.Parent.Name == "Backpack" then
		w:Destroy()
		s:Destroy()
		script.Parent.Handle1.Handle.Rotation = Vector3.new(0, 0, 0)
		script.Parent.Handle2.Handle.Rotation = Vector3.new(0, 0, 0)
		script.Parent.Handle1.Handle.Anchored = true
		script.Parent.Handle2.Handle.Anchored = true
		weldgot = true
	end
end)
12 Likes

Uhhh, I think I made a gun that have duel wield function, let me search for it…

2 Likes

This is how I weld my Gun’s Handle and Hand together using serverside Function I made.

  local motor = Instance.new("Motor6D")
	motor.Part1,motor.Part0 = brick1,brick0
	motor.C0 = CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0)) --This is an offset for Weapon and it's not a world position for a weapon
	motor.Parent = brick0

When you weld tool you don’t set their rotation by their tool, you set them by their weld’s C0. you can replace motor with weld it doesn’t matter. brick1 is hand and brick0 is weapon’s handle and you must parent them after you finished welded them otherwise it will look weird in some way. I can’t explain clearly cause I didn’t study deep inside these function

7 Likes

yo nice thank you you helped me really much :slight_smile:

No problem my pal!

30 characters

3 Likes

There’s a 100x easier way to handle dual wielding weapons, by the way. It involves the use of accessories. I have made a mini tutorial on it in the past and answered a question about making it work with a left hand (for the sake of left-handed tools or dual wielding).

1 Like

I don’t think 2 handle can be attached in same the object, I never tried it but believe it doesn’t work
oh actually I get it, you used accessory and then real tool, sorry about that.

Dude I had no clue that this was possible, thank you so much!
I want to ask if this could be used to make a sort of quad wielding thing? If it was possible to create another set of arms and have there be swords/guns in each hand?

Would this method still work?

Yes! If you want to add more limbs to the Humanoid, you absolutely can use this method to attach tools to those extra arms. Accessories are great in that way: the way they’re added to Humanoids isn’t hard coded, they only look for matching attachment names in the accessory handle and the character before creating a weld between the two. Check it out:


image

Also a little cheat code for you: if you want to avoid using accessories or weld the tools yourself in case accessories don’t work for any reason for you, then you absolutely can do that as well. I recently found out how the Humanoid attaches accessories. I still recommend, if possible, using accessories so the engine can take care of the heavy lifting for you.

Accessories are welded to limbs using in this manner:

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

EDIT 12/03/2021: Use RigidConstraints to snap accessories together by their attachments instead.

4 Likes