Why does my corpse do this?

Hello !
After a lot of time, I’ve finally fixed this corpse system (thanks to TheDCraft ) But the corpse always finish in this position :
Lol
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)
1 Like

Can you show a video of what happens?

Here it is

If you know how to remove the exploding rig too

Set the StarterHumanoid’s BreakJointsOnDeath to false. If you don’t have a StarterHumanoid already, insert a Humanoid object into the StarterPlayer service, and name it “StarterHumanoid”.

Nah I mean… Like to make it more realistic, you remove the exploding thing (with BreakJointOnDeath it’ll make the rig do a salute) like just delete the rig so we just keep the corpse

For your character you can :LoadCharacter() that should fix the exploding parts. Make sure that HumanoidRootPart = false for the cloned character. I think what happens that the character you clone also dies so it just collects all the parts, maybe changing the cloned characters humanoid to give it more health, or changing the State.

I tried to remove the humanoid, but if I do that it"ll remove its clothes too
:thinking:

Can’t you just destroy all of the character’s limbs? Something like

for i,v in pairs(character:GetChildren()) do
    if v:IsA(“BasePart”) then
       v:Destroy()
    end
end

You shouldn’t remove the humanoid, you need that. Just make sure the cloned model isn’t in the dead state.

Doesn’t work, sorry for the delay it was nearly 23H in France

	char.Humanoid.Health = math.huge

I’m pretty sure that the CanCollide property of limbs (arms and legs) is set to false every frame, when your character is in certain humanoid states.
So to fix this, you have to move the character’s arms and legs into a folder that is parented to the character.
It’s all very vague. I can’t seem to find advanced information on humanoid states anywhere, so I’m speaking from experience.

Wait, Imma make me die, then i’ll check the property of the cloned model

Yes, I created a folder in the cloned model, and CanCollide can be activated,
Only problem is that it remove the clothes

By exploding I’m assuming you’re referring to the red damage vignette you experience on screen after taking damage.

To disable it you just have to disable Health in CoreGui.