Sword Equipping in the middle of the arm (R6)

Hello, I’m making a sword combat system. So far I made that you can equip the sword from its case to the Players right arm, like so:

Screenshot 2023-12-29 192301

But the problem is that the sword is held in the middle of the arm, as shown in the picture. I want it to be lower so that it’s more realistic. Like this:

The script:

local rp = game:GetService("ReplicatedStorage")
local sword = rp:WaitForChild("Sword")

local cframes = {
	["Right Arm"] = CFrame.new(0, -1, 0),
	["Right Hand"] = CFrame.new(0, 0, 0),
}

sword.OnServerEvent:Connect(function(Player, isEquipped)
	local Character = Player.Character
	local Humanoid = Character.Humanoid
	
	if isEquipped then 
		-- Equipping the sword
		local Katana = Character:FindFirstChild("Katana")
		if Katana then
			local SideWeld = Katana.PrimaryPart:FindFirstChild("SideWeld")
			if SideWeld then
				SideWeld:Destroy()
				----------------------------------------------------------------------------------------------------------------
				if Humanoid.RigType == Enum.HumanoidRigType.R15 then
					Katana:SetPrimaryPartCFrame(Character:WaitForChild("Right Hand").CFrame * cframes["Right Hand"])
				elseif Humanoid.RigType == Enum.HumanoidRigType.R6 then
					Katana:SetPrimaryPartCFrame(Character:WaitForChild("Right Arm").CFrame * cframes["Right Arm"])
				end
				
				local HandWeld = Instance.new("ManualWeld")
				HandWeld.Part0 = Katana.PrimaryPart
                --------------------------------------------------------------------------------         --------------------------------
				if Humanoid.RigType == Enum.HumanoidRigType.R15 then
					HandWeld.Part1 = Character:WaitForChild("Right Hand")
				elseif Humanoid.RigType == Enum.HumanoidRigType.R6 then
					HandWeld.Part1 = Character:WaitForChild("Right Arm")
				end
				
				HandWeld.C0 = HandWeld.Part1.CFrame:ToObjectSpace(HandWeld.Part1.CFrame)
				HandWeld.Parent = HandWeld.Part0
				----------------------------------------------------------------------------------------------------------------
			end
		end
		
	elseif not isEquipped then
		--Unequipping the sword
	end
	
end)

I’ve already tried to change the CFrames in the cframes table, but it didn’t work.

Please help and thank you. :slightly_smiling_face:

EDIT: the sword isn’t a tool, it spawns when you join the game.

Change the tool’s Grip Position
image

Sorry forgot to mention, the sword isn’t a tool, it spawns when you join the game.

CFrame needs at least one Vector3 value inside of it. The first value is for the position, second for where the object is looking (Look Vector.)

Change lines 4-7 to this and see if it helps:

local cframes = {
	["Right Arm"] = CFrame.new(Vector3.new(0, -1, 0)),
	["Right Hand"] = CFrame.new(Vector3.new(0, 0, 0)),
}
1 Like

Still…

image

Maybe try using a WeldConstraint instead of a regular Weld because welded objects attach to the centers of each other while WeldConstraints keep the objects locked on to each other but in the position they are currently in.

2 Likes

Right, I’ll try it out, Thank you!

1 Like

No problem. Notify me if there is another issue.

1 Like

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