Character arms acting weird when unequips dual swords

  1. What do you want to achieve?
  • Dual Sword On Back When Unequip
  1. What is the issue?

image

  • As you can see the picture above, When I unequips the dual sword both arms are still welded to the sword
  1. What solutions have you tried so far?
  • Searched yt, google but no results

I have 2 scripts that messes with welding dual swords

Weld Dual Sword On Back Script:

handle = nil
handle2 = nil

function onUnequipped()
	if script.Parent.Parent == workspace or script.Parent.Parent.className ~= "Backpack" then
		return
	end

	local char = script.Parent.Parent.Parent.Character
	if char ~= nil then
		local torso = char:FindFirstChild("Torso")
		local tool = char:FindFirstChild(script.Parent.Name)
		if torso ~= nil and tool == nil then
			local model = Instance.new("Model")
			model.Name = script.Parent.Name
			model.Parent = char
			
			local model2 = Instance.new("Model")
			model2.Name = script.Parent.Name
			model2.Parent = char
			
			handle = script.Parent.Handle:Clone()
			handle2 = script.Parent.Handle2:Clone()
			
			handle.CanCollide = false
			handle2.CanCollide  = false
			
			handle.Name = "Handle"
			handle2.Name = "Handle2"
			
			handle.Parent = model
			handle2.Parent = model2

			local weld = Instance.new("Weld")
			weld.Name = "BackWeld"
			weld.Part0 = torso
			weld.Part1 = handle
			weld.C0 = CFrame.new(0,0,0.6)
			weld.C0 = weld.C0 * CFrame.fromEulerAnglesXYZ(math.rad(90),math.rad(330),0)
			weld.Parent = handle
			
			local weld2 = Instance.new("Weld")
			weld2.Name = "BackWeld2"
			weld2.Part0 = torso
			weld2.Part1 = handle2
			weld2.C0 = CFrame.new(0,0,-0.6)
			weld2.C0 = weld.C0 * CFrame.fromEulerAnglesXYZ(0,math.rad(420),0)
			weld2.Parent = handle2--]]
		end
	end
end

script.Parent.Unequipped:Connect(onUnequipped)

function onEquipped()
	
	if handle.Parent then
		handle.Parent:Destroy()
		handle2.Parent:Destroy()
	end
end

script.Parent.Equipped:Connect(onEquipped)

Welding Dual Sword When Equip Script:

script.Parent.RemoteEvent.OnServerEvent:Connect(function(player, Equip)
	
	local weld1 = Instance.new("Weld")
	local weld2 = Instance.new("Weld")
	
	if Equip then
		local character = player.Character
		local RHandle = script.Parent.Handle
		local LHandle = script.Parent.Handle2
		local leftArm = character:WaitForChild("Left Arm")
		local rightArm = character:WaitForChild("Right Arm")

		weld1.Parent = LHandle
		weld1.Part0 = leftArm
		weld1.Part1 = LHandle
		weld1.C0 = CFrame.new(0,-1,-1.7)
		weld1.C0 = weld1.C0 * CFrame.Angles(0,math.rad(180),math.rad(90))

		weld2.Parent = RHandle
		weld2.Part0 = rightArm
		weld2.Part1 = RHandle
		weld2.C0 = CFrame.new(0,0,0)--]]
	elseif not Equip then
		print("Not Equip")
		weld1:Destroy()
		weld2:Destroy()
	end
end)

ERROR
Weld Back Back Script

Classic Sword.WeldToBackScript:57: attempt to index nil with 'Parent'
1 Like