How to make the ragdoll transition smoother?

As you can see in the video, when the character gets ragdolled, its position seems to snap / teleport.

Below, there is the code that makes the ragdoll. How can I make this smoother?

function module.Ragdoll(player, bool)
	local Character = player.Character
	local Humanoid = Character["Humanoid"]
	local Motors = {Character.Torso["Left Hip"], 
		Character.Torso["Right Hip"], 
		Character.Torso["Left Shoulder"], 
		Character.Torso["Right Shoulder"],
		Character.Torso["Neck"],
		Character.PrimaryPart["Root Hip"]
	}
	
	if bool then
		for _, obj in pairs(Motors) do
			local a0, a1 = Instance.new("Attachment"), Instance.new("Attachment")
			a0.CFrame = obj.C0
			a1.CFrame = obj.C1
			a0.Parent = obj.Part0
			a1.Parent = obj.Part1
			local BallSocket = Instance.new("BallSocketConstraint")
			BallSocket.LimitsEnabled = true
			BallSocket.TwistLimitsEnabled = true
			if obj == Character.Torso["Neck"] then
				BallSocket.TwistLimitsEnabled = true
			end
			BallSocket.Attachment0 = a0
			BallSocket.Attachment1 = a1
			BallSocket.Parent = obj.Part0
			obj.Enabled = false
		end
	end
end

Edit: I figured out that if I disabled limits enabled and twistlimitsenabled it would work! But doesnt really have the same behavior. How would I accomplish this with a similar effect?

3 Likes

So this is a crazy like guess. I’m gonna throw this out here. Maybe you can make a module script, that contains a function that creates a new tween. Hear me out.

So in your code you see you’re setting CFrames right? Well what if you instead TWEEN them. Right? In theory that would work, I feel that’s where it’s snapping, whereas you can tween them and make it smoother?

Again this is completely unfounded and probably irrational but it’s an idea, let me know if it works and I might be able to help a bit!

It was a good suggestion but uh… Some funny stuff happened xD


Basically each limb gets snapping one by one. It is funny, ngl.

2 Likes

How are you implementing said function?

I just created a tween in the loop while comenting the cframe assignements.

I figured out that if I disabled limits enabled and twistlimitsenabled it would work! But doesnt really have the same behavior. How would I accomplish this with a similar effect?

What do you mean by behavior? Like it doesn’t ragdoll the way it did before?

No. The limbs basically dont have restrictions, as they had otherwise. I would like to have these restrictions without doing that kicking or whatever. If I cannot make this restriction, I guess I will just leave it like this. :man_shrugging:

Honestly it’s probably best to have it how you originally had it, but I’ll start messing around to see if I can make it nicer. I’ll PM you if I can.

1 Like