Armor not positioning properly

I was trying to make a quick little script that grabs all the parts in the armor model and welds each of them to the corresponding player limb based on the parent they’re in. It clones and welds properly but my issue is that it’s not being positioned properly as you can see in the pictures below.

Any help is much appreciated.

WeldFunction

local function CreateWeld(Part0, Part1)
	local weld = Instance.new("Weld")
	weld.Name = "ArmorWeld"
	weld.Parent = Part0
	weld.Part0 = Part0
	weld.Part1 = Part1
	Part0.CFrame = Part1.CFrame
	

end

WeldParts Function:

local function weldParts(PlayerLimb, ArmorLimb)
	if ArmorLimb and PlayerLimb then
		if ArmorLimb:IsA("Model") then
			for _, Part in pairs(ArmorLimb:GetDescendants()) do
				if Part:IsA("BasePart") then
					CreateWeld(Part, PlayerLimb)
				end
			end
		elseif ArmorLimb:IsA("UnionOperation") then
			CreateWeld(ArmorLimb, PlayerLimb)
			
		elseif ArmorLimb:IsA("MeshPart") then
			CreateWeld(ArmorLimb, PlayerLimb)
		
		end
	end
end

EquipArmor Function:

local function equipArmorToPlayer(player, armor)
	local character = player.Character
	if character then
		local humanoid = character:FindFirstChildOfClass("Humanoid")
		if humanoid then
			local armormodel = armor:Clone()
			armormodel.Parent = character.ArmorHolder

			character:FindFirstChild("Clothing"):Destroy()

			local armormodelparts = {
				ArmorHead = armormodel:FindFirstChild("ArmorHead"),
				ArmorLeftArm = armormodel:FindFirstChild("ArmorLeftArm"),
				ArmorRightArm = armormodel:FindFirstChild("ArmorRightArm"),
				ArmorLeftLeg = armormodel:FindFirstChild("ArmorLeftLeg"),
				ArmorRightLeg = armormodel:FindFirstChild("ArmorRightLeg"),
				ArmorTorso = armormodel:FindFirstChild("ArmorTorso"),
			}

			local PlayerLimbs = {
				PlayerHead = character:WaitForChild("Head"),
				PlayerLeftArm = character:WaitForChild("Left Arm"),
				PlayerRightArm = character:WaitForChild("Right Arm"),
				PlayerLeftLeg = character:WaitForChild("Left Leg"),
				PlayerRightLeg = character:WaitForChild("Right Leg"),
				PlayerTorso = character:WaitForChild("UpperTorso"),
			}

			for armorPartName, armorPart in pairs(armormodelparts) do
				local playerPart = PlayerLimbs[string.gsub(armorPartName, "Armor", "Player")]
				if armorPart and playerPart then
					weldParts(playerPart, armorPart)
				end
			end
		end
	end
end

Heres a picture of what it should look like:
image

Heres what it looks like when welded:
image

Welding does work properly:
image

1 Like

After playing around with the welding I got it to work.
image

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