Character falls through floor with ragdoll script

local Ragdoll = {}

Ragdoll.Setup = function(Character)
	local jointsClone = script.Joints:Clone()
	jointsClone.Parent = Character
	
	for _, V in script["Torso Attachments"]:GetChildren() do
		local Clone = V:Clone()
		Clone.Parent = Character.Torso
		
		jointsClone[V.Name].Attachment0 = Clone
	end
	
	for _, V in script["Limb Attachments"]:GetChildren() do
		local Clone = V:Clone()
		Clone.Parent = Character[V.Name]
		
		jointsClone[V.Name].Attachment1 = Clone
	end
	
	local CollisionsClone = script.Collisions:Clone()
	CollisionsClone.Parent = Character
	
	for _, V in CollisionsClone:GetChildren() do
		V.Part0 = Character.Torso
		V.Part1 = Character[V.Name]
	end
	
	jointsClone.HumanoidRootPart.Part1 = Character.HumanoidRootPart
	jointsClone.HumanoidRootPart.Part0 = Character.Torso
	
	Character:AddTag("Setup")
end

local LimbWhitelist = {
	"Left Leg",
	"Right Leg",
	"Left Arm",
	"Right Arm",
	"Torso",
	"Head"
}

Ragdoll.Ragdoll = function(Character, RagTime)
	if Character:HasTag("Setup") then
		for _, V in Character:GetChildren() do
			if table.find(LimbWhitelist, V.Name) and V:IsA("BasePart") then
				V.CanCollide = true
			end
		end
		for _, V in Character.Torso:GetChildren() do
			if V:IsA("Motor6D") then
				V.Enabled = false
			end
		end
		Character.Humanoid.Sit = true
		task.wait(RagTime)
		for _, V in Character.Torso:GetChildren() do
			if V:IsA("Motor6D") then
				V.Enabled = true
			end
		end
		for _, V in Character:GetChildren() do
			if table.find(LimbWhitelist, V.Name) and V:IsA("BasePart") then
				V.CanCollide = false
			end
		end
		Character.Humanoid.Sit = false
	end
end



return Ragdoll

This is a custom ragdoll script i made cus id like to make one instead of taking one out of the toolbox, my issue it that the character still falls through the floor after using the “Ragdoll” function.

for _, V in Character:GetChildren() do
	if table.find(LimbWhitelist, V.Name) and V:IsA("BasePart") then
		V.CanCollide = true
	end
end

This line should prevent that, but it doesnt turn on can collide for some reason, all the parts on the character still have can collide off.

1 Like

I fixed it nevermind, i just had to turn on cancollide every frame

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