So I have made a little 3D modeled suit and I’m attempting to put it onto my character. I’ve been somewhat successful, however the fit is not quite right and I’m not sure how to go about fixing it.
My thinking was that I could use the differences in the model version’s [Left] limbs and suit parts to properly fit the pieces for an actual character. As you can see, my solution seems to be faulty. [Right]
(Sorry if this post is formatted poorly, I’m not familiar with the forums quite yet.)
Code
`function AttemptCostume(Character)
local Costume = game.ReplicatedStorage.CostumeModel
for i,v in pairs(Costume:GetChildren()) do
if v:IsA("MeshPart") then
-- is a body part, may have costume piece.
local Children = v:GetChildren()
if #Children > 0 then
-- It has a part, get needed location data.
local AttirePos = Children[1].Position
local LimbPos = v.Position
local PositionData = Vector3.new(AttirePos.X/LimbPos.X, AttirePos.Y/LimbPos.Y, AttirePos.Z/LimbPos.Z)
-- Put part onto character model.
local PlayerLimb = Character:FindFirstChild(v.Name)
local PartClone = Children[1]:Clone()
local Weld = Instance.new("WeldConstraint")
PartClone.CFrame = PlayerLimb.CFrame * CFrame.Angles(Children[1].Orientation.X * (math.pi/180), Children[1].Orientation.Y * (math.pi/180), Children[1].Orientation.Z * (math.pi/180)) * CFrame.new(PositionData - Vector3.new(1,1,1))
PartClone.Name = "Costume"..PlayerLimb.Name
PartClone.Parent = Character
Weld.Part0 = PlayerLimb
Weld.Part1 = PartClone
Weld.Parent = PlayerLimb
PartClone.Anchored = false
--EX. Player to Costume differences.
--596.5, 23.333, -533.914 [Torso]
--596.006, 23.534, -533.807 [Jacket]
end
end
end
end`
I’d appreciate any input on fixing this,
Thanks!