I made an armor welding and attaching system for enlarged humanoid models. The welding is fine, but whenever my character model (or after a few minutes passes) touches the enlarged humanoid, some of its limbs become stiff.
The question is, how would I prevent the stiffness from happening?
Before stiffness
After stiffness
After a certain while, the boss is stiffed up so much that it just glides into the baseplate
Here is the code:
local function Welding(skin)
for all, accessory in pairs(skin:GetChildren()) do
local skinModel = accessory:FindFirstChildOfClass("Model")
local skinHandle = accessory:FindFirstChild("Handle")
-- weld all parts of the skin to the handle
skinHandle.Massless = true
skinHandle.Anchored = false
skinHandle.CanCollide = false
for all, skinPart in pairs(skinModel:GetChildren()) do
local weldConstraint = Instance.new("WeldConstraint")
weldConstraint.Part0 = skinPart
weldConstraint.Part1 = skinHandle
-- massless parts + cannot collide
skinPart.Massless = true
skinPart.Anchored = false
skinPart.CanCollide = false
weldConstraint.Parent = skinPart
end
end
end
local function attachSkinToCharacter(character, skin)
for all, accessory in pairs(skin:GetChildren()) do
local skinHandle = accessory:FindFirstChild("Handle")
local rigidConstraint = Instance.new("RigidConstraint")
local bodyPartName = accessory.Name
local attachmentName = skinHandle:FindFirstChildOfClass("Attachment").Name
local BodyPart = character:WaitForChild(bodyPartName)
rigidConstraint.Attachment0 = skinHandle:FindFirstChildOfClass("Attachment")
rigidConstraint.Attachment1 = BodyPart:WaitForChild(attachmentName)
rigidConstraint.Parent = skinHandle
accessory.Parent = character
end
end
Welding(PreviewArmor)
attachSkinToCharacter(BossModel, PreviewArmor)