Ragdoll constantly glitching around

Hello! So I am currently making a ragdoll system for an RPG game I’m working on, and it works for the most part but… every time the player gets ragdolled, they start glitching around a LOT while they are ragdolled. They don’t end up actually getting flung but this is causing some lag and is visually unappealing.
Additionally, this is being called from a server script

Here is my current ragdoll function:

function module.Ragdoll(Character)
	local CT = CombatTable[Character.Name]
	
	if not CT.Ragdolled then
		CT.Ragdolled = true
		CT.WallRunning = false
		CT.Running = false
		CT.MaxMomentum = 10
		CT.Acceleration = 1

		if game.Players:GetPlayerFromCharacter(Character) then
			Character.HumanoidRootPart.Movement.VectorVelocity = Vector3.new(0,0,0)
			Character.HumanoidRootPart.Movement.Enabled = false
		end
		
		for i, part in ipairs(Character:GetDescendants()) do
			if part:IsA("Motor6D") then
				local Socket = Instance.new("BallSocketConstraint")
				local a1 = Instance.new("Attachment")
				local a2 = Instance.new("Attachment")
				a1.Parent = part.Part0
				a2.Parent = part.Part1
				Socket.Parent = part.Parent
				Socket.Attachment0 = a1
				Socket.Attachment1 = a2
				a1.CFrame = part.C0
				a2.CFrame = part.C1
				Socket.LimitsEnabled = true
				Socket.TwistLimitsEnabled = true

				part.Enabled = false
			elseif part:IsA("BasePart") and not CS:HasTag(part, "Tool") and part.Name ~= "Handle" then
				CreateCollisionPart(part)
			end
		end

		Character.Humanoid.RequiresNeck = true
		Character.Humanoid.HipHeight = 0

		Character.Humanoid.WalkSpeed = 0
		Character.Humanoid.JumpHeight = 0

		Character.Humanoid.PlatformStand = true

		Character.Humanoid.AutoRotate = false
	end
end

And here is the CreateCollisionPart function:

function CreateCollisionPart(Original)	
	local player = Players:GetPlayerFromCharacter(Original.Parent)
	
	local part = Instance.new("Part")
	part.Name = "FakePart"
	part.CanCollide = true
	part.Size = Original.Size
	part.Transparency = 1
	part.Massless = true
	part.Parent = Original
	part:SetNetworkOwner(player or nil)

	local weld = Instance.new("Weld")
	weld.Part0 = part
	weld.Part1 = Original
	weld.Parent = part
end

I’m pretty sure it’s a collision issue but I don’t know what to do to fix it.
Any suggestions?

Here is a video for reference if that helps:
robloxapp-20240208-1324205.wmv (1.1 MB)

Check if it’s to do with the HumanoidRootPart overlapping the Torso. I think with the code you have, you’re creating 2 fake parts in the same location since the torso and root part are in the same place. That might be the issue - good if you visualise it by making normal body parts transparent and the fake parts visible.

May also be worth making the fake parts smaller than the original parts, just by a little.

1 Like

You were right, the issue was the HumanoidRootPart overlapping with the torso. Thanks for the help! :smiley:

1 Like

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