I am making an armor system for my game, and I am using a 3-part model for the visual part of the armor. For the most part, the cuirass/chestplate works fine, keeping the offset I give it in the code. However, the welds on the pauldrons are for some reason resetting the offset (picture shows unintended behavior, where the top of the arm clips through the pauldrons)
I’ve tried a few things and narrowed it down to something with the welds, as if I comment out the weld code for the pauldrons they do appear where they would with the offsets. The weird thing is that the code for the cuirass/chestplate welding is the EXACT SAME as the code for the pauldrons.
local function EquipPlayerArmor(ItemID:number, char:Model)
-- these first lines are probably irrelevant, but it gives some context to what is going on.
local ArmorName = IDConversions.ItemIDToString(ItemID)
local ArmorModel:Model
for i, v in pairs(char:GetChildren()) do
if v.Name == "ArmorModel" then
v:Destroy()
end
end
for i, v in pairs(ServerStorage.ArmorModels:GetChildren()) do
if v.Name == ArmorName then
ArmorModel = v:Clone()
end
end
-- relevant code starts here
if ArmorModel then
ArmorModel.Cuirass.CFrame = char.PrimaryPart.CFrame * CFrame.Angles(0, math.rad(-90), 0)
ArmorModel.Cuirass.Position += Vector3.new(0,0.08,0) -- this is the offset for the cuirass/chestplate (i know for a fact this works)
ArmorModel.LeftPauldron.CFrame = char.LeftUpperArm.CFrame * CFrame.Angles(0, math.rad(-90), 0)
ArmorModel.LeftPauldron.Position += (Vector3.new(0,0.35,-0.1) * char.PrimaryPart.CFrame.LookVector) -- this is the offset for the left pauldron (definitely the wrong numbers, but that's not the point of the post)
--ArmorModel.LeftPauldron.Anchored = true
ArmorModel.RightPauldron.CFrame = char.RightUpperArm.CFrame * CFrame.Angles(0, math.rad(-90), 0)
ArmorModel.RightPauldron.Position += (Vector3.new(0,0.35,0.1) * char.PrimaryPart.CFrame.LookVector) -- this is the offset for the right pauldron (definitely the wrong numbers, but that's not the point of the post)
--ArmorModel.RightPauldron.Anchored = true
-- cuirass weld code
local CuirassWeld = Instance.new("WeldConstraint")
CuirassWeld.Parent = ArmorModel.Cuirass
CuirassWeld.Part0 = ArmorModel.Cuirass
CuirassWeld.Part1 = char.UpperTorso
-- left pauldron weld code
local LeftPauldronWeld = Instance.new("WeldConstraint")
LeftPauldronWeld.Parent = ArmorModel.LeftPauldron
LeftPauldronWeld.Part0 = ArmorModel.LeftPauldron
LeftPauldronWeld.Part1 = char.LeftUpperArm
-- right pauldron weld code
local RightPauldronWeld = Instance.new("WeldConstraint")
RightPauldronWeld.Parent = ArmorModel.RightPauldron
RightPauldronWeld.Part0 = ArmorModel.RightPauldron
RightPauldronWeld.Part1 = char.RightUpperArm
ArmorModel.Parent = char
ArmorModel.Name = "ArmorModel"
end
end
I’ve swapped the part0/part1 on the weldconstraints, changed the offsets to see if they were wrong, disabled the welding code to see if the offsets were actually applying before the weld (they were), and searched for anything relevant on here. Any help is appreciated, thank you for reading.