How to turn my iron man suit to fit player?

So I have an iron man suit, which is supposed to go onto a player. It welds each part onto a player based on the players body part cframe. But instead, whenever I used it, the suit goes on slanted. The script I used was:
local function weld(a, b)
local w = Instance.new(“ManualWeld”, a)
w.Name = “Weld”
w.C0 = a.CFrame:inverse() * b.CFrame
w.Part0 = a
w.Part1 = b
end
To fix this, I tried multiplying that with cframe angles to get:
local function weld(a, b)
local w = Instance.new(“ManualWeld”, a)
w.Name = “Weld”
w.C0 = a.CFrame:inverse() * b.CFrame * CFrame.Angles(0,-180,0)
w.Part0 = a
w.Part1 = b
end
This doesn’t work, so I was wondering how to fix this. It makes the suit parts spread out and weird. Thank you to anyone who tries to help.

1 Like

Is the rest of the suit welded also, please format your code.

1 Like

The rest of the suit is not welded together and how do you format code.

Try using :toObjectSpace on the CFrame for C0 then?
ex
Weld.C0 = Part1.CFrame:toObjectSpace(Part2.CFrame)

It does the same thing that the other one did.

Try moving the parts to the character’s body first then anchoring them and see if their tilted then Don’t weld though

1 Like

The easiest way to make sure you don’t get any weird angles when adding armor of any sort that I’ve found is to set it up with a primary part. Put a PrimaryPart over the entire section of armor and weld every piece of armor to it (I use OzzyPig’s welding plugin for that since it’s easier) and then just weld the primary part to the player. That’s what I do for my Iron Man armors and it does pretty well.

Something like this,

3 Likes

Yes, if you want to make it snap into place with a CFrame match you need to make sure your objects were made in the same orientated space. Suit front = Player front.

A retro fix is to add a part(set as PrimaryPart) into the suit piece that matches the players CFrame and weld it to your suit piece; creating an anchor for the attached piece.

The PrimaryPart space is used by the complex object instead of whatever mess occurred during generation, effectively removing the misalignment.

3 Likes

If the parts are made in the same orientation (i.e. front of armour is front of player) then leave C0 and C1 unassigned. That will make the armour and the body part line up to match their centers.

Yeah, you can just use the WeldConstraint with part0 and part1, once orientated.

Put four spaces before your code to format it.

It’s hard to understand the code when it’s not formatted in the clear programming font.This makes it hard to figure out a solution.

1 Like

Sounds good. Thank you for your help!