Hello !
After a lot of time, I’ve finally fixed this corpse system (thanks to TheDCraft ) But the corpse always finish in this position :
Here is the script :
local function ConnectLimbs(char)
char = char:Clone()
char.Parent = workspace
char.Humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
char.Humanoid.HealthDisplayType = Enum.HumanoidHealthDisplayType.AlwaysOff
game:GetService("Debris"):AddItem(char, 300)
for i, limb in pairs(char:GetChildren()) do
if limb:IsA("BasePart") then
local atch0, atch1, atch2, atch3, atch4, atch5
if limb.Name == "Head" then
atch0 = char.Head.NeckRigAttachment
atch1 = char.UpperTorso.NeckRigAttachment
elseif limb.Name == "UpperTorso" then
atch0 = char.UpperTorso.WaistRigAttachment
atch1 = char.LowerTorso.WaistRigAttachment
atch2 = char.UpperTorso.LeftShoulderRigAttachment
atch3 = char.LeftUpperArm.LeftShoulderRigAttachment
atch4 = char.UpperTorso.RightShoulderRigAttachment
atch5 = char.RightUpperArm.RightShoulderRigAttachment
elseif limb.Name == "LowerTorso" then
atch0 = char.LowerTorso.LeftHipRigAttachment
atch1 = char.LeftUpperLeg.LeftHipRigAttachment
atch2 = char.LowerTorso.RightHipRigAttachment
atch3 = char.RightUpperLeg.RightHipRigAttachment
elseif limb.Name == "LeftUpperLeg" then
atch0 = char.LeftUpperLeg.LeftKneeRigAttachment
atch1 = char.LeftLowerLeg.LeftKneeRigAttachment
elseif limb.Name == "RightUpperLeg" then
atch0 = char.RightUpperLeg.RightKneeRigAttachment
atch1 = char.RightLowerLeg.RightKneeRigAttachment
elseif limb.Name == "LeftLowerLeg" then
atch0 = char.LeftLowerLeg.LeftAnkleRigAttachment
atch1 = char.LeftFoot.LeftAnkleRigAttachment
elseif limb.Name == "RightLowerLeg" then
atch0 = char.RightLowerLeg.RightAnkleRigAttachment
atch1 = char.RightFoot.RightAnkleRigAttachment
elseif limb.Name == "LeftUpperArm" then
atch0 = char.LeftUpperArm.LeftElbowRigAttachment
atch1 = char.LeftLowerArm.LeftElbowRigAttachment
elseif limb.Name == "RightUpperArm" then
atch0 = char.RightUpperArm.RightElbowRigAttachment
atch1 = char.RightLowerArm.RightElbowRigAttachment
elseif limb.Name == "LeftLowerArm" then
atch0 = char.LeftLowerArm.LeftWristRigAttachment
atch1 = char.LeftHand.LeftWristRigAttachment
elseif limb.Name == "RightLowerArm" then
atch0 = char.RightLowerArm.RightWristRigAttachment
atch1 = char.RightHand.RightWristRigAttachment
end
if atch0 and atch1 then
local ballInSocket = Instance.new("BallSocketConstraint", limb)
ballInSocket.Attachment0 = atch0
ballInSocket.Attachment1 = atch1
end
if atch2 and atch3 then
local ballInSocket = Instance.new("BallSocketConstraint", limb)
ballInSocket.Attachment0 = atch2
ballInSocket.Attachment1 = atch3
end
if atch4 and atch5 then
local ballInSocket = Instance.new("BallSocketConstraint", limb)
ballInSocket.Attachment0 = atch4
ballInSocket.Attachment1 = atch5
end
elseif limb:IsA("Accessory") then
local h = limb:FindFirstChild("Handle")
if h then
local part0 = char.Head
local atch = h:FindFirstChildOfClass("Attachment")
if atch.Name == "HatAttachment" or atch.Name == "FaceFrontAttachment" then
part0 = char.Head
end
local ap = Instance.new("AlignPosition", part0)
if part0 == char.Head then
ap.Attachment1 = char.Head:FindFirstChild(atch.Name)
ap.Attachment0 = atch
ap.RigidityEnabled = true
ap.Responsiveness = 200
end
local ao = Instance.new("AlignOrientation", part0)
if part0 == char.Head then
ao.Attachment1 = char.Head:FindFirstChild(atch.Name)
ao.Attachment0 = atch
ao.RigidityEnabled = true
ao.Responsiveness = 200
end
end
end
end
end
game:GetService("Players").PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(Character)
Character:WaitForChild("Humanoid").Died:Connect(function()
ConnectLimbs(Character)
local test = (Character:GetChildren())
local testing = Instance.new("Model",workspace)
for i = 1, #test do
local child = test[i]
child:Clone().Parent = testing
end
end)
end)
end)