Problem with ragdoll script

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I’ve tried to make a simple ragdoll script that makes the ragdoll stay, well it works but the limbs get their collisions turned off which looks weird.
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

The problem is that everytime the character makes any heavy movement the limb collisions get turned off which looks goofy.
The way i made the limbs swing around is with pre-placed ballsocket constraints in the StarterCharacter ( they dont turn on till the character dies for some reason so i didnt go about into making each one in the script )

   local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")
local died = script.Parent:WaitForChild("Dead")

function rag()
	if died.Value == false then
		died.Value = true
		humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
		humanoid.HealthDisplayType = Enum.HumanoidHealthDisplayType.AlwaysOff
		local root = character:WaitForChild("HumanoidRootPart")
		character.Torso.Anchored = true
		root.Anchored = true
		root.CanCollide = false
		character.Archivable = true

		wait()

		local charClone = character:Clone()
		character.Archivable = false
		charClone.Name = character.Name .. "-2"
		charClone.HumanoidRootPart.Anchored = false
		charClone.Torso.Anchored = false
		charClone.Parent = workspace
		for i, part in ipairs(character:GetChildren()) do
			if part:IsA("BasePart") then
				part.Transparency = 1
				part.CanCollide = false
			end
		end
		character.Head.face:Destroy()
		charClone.Animate:Destroy()
		charClone.Archivable = false
		charClone.Ragdoll.Value = true
		for i, part in ipairs(charClone:GetChildren()) do
			if part:IsA("BasePart") then
				part.CanCollide = true
			end
		end
		wait(0.5)
		return
	end
	
end

while true do
	task.wait()
	if humanoid.Health == 0 and died.Value == false then
		rag()
	end
end

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

1 Like

I’ve found a gimmicky bandaid fix by adding a part as the collision for each limbs when the ragdoll is created, which works like a charm.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.