R15 Ragdoll Glitches out when hit hard

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

I am trying to create a ragdoll game. I have the scripts i want already but ive come across a weird issue that my friends have come to notice.

When using r15, npcs or players, if the player hits an object at a high speed, the BallSocketConstraints seem to freak out and cause the character to act funny.\

here is a video.

I have attempted many solutions Ive seen but no post has had any problems that I have. I have seen many games not have this problem. I have 0 clue why this is happening.

Here is the function of the script that ragdolls the player on the server:

function fall(player, char)
	for v,i: Instance in pairs(char:GetDescendants()) do
		char:FindFirstChildOfClass("Humanoid"):ChangeState(Enum.HumanoidStateType.Physics)

		if i:IsA("BasePart") or i:IsA("MeshPart") then
			if i:CanSetNetworkOwnership() then i:SetNetworkOwner() end
			if i.Name ~= "HumanoidRootPart" and not string.find(string.lower(i.Name), "torso", 1) and not string.find(i.Name, "Handle", 1) then
				local fake = Instance.new("Part")
				fake.Transparency = 1
				fake.Parent = i
				fake.Name = "FAKE"
				fake.Size = i.Size*0.9
				local weld = Instance.new("Weld")
				weld.Name = "FAKE"
				weld.Part0 = i
				weld.Part1 = fake
				weld.Parent = i
			end
		end

		if string.find(i.Name, "Upper") and i.Parent:FindFirstChildOfClass("Humanoid") then
			if i:FindFirstChild("FAKE") then
				i.FAKE:Remove()
			end
			i.CanCollide = false
		end

		if i:IsA("Motor6D") and i.Parent.Name ~= "HumanoidRootPart" then
			local w: Motor6D = i
			local part0 = w.Part0
			local part1 = w.Part1

			local b = Instance.new("BallSocketConstraint")
			b.LimitsEnabled = true
			b.TwistLimitsEnabled = true
			b.UpperAngle = 20

			local a0 = Instance.new("Attachment")
			a0.Name = "ragdollAttachment"
			local a1 = Instance.new("Attachment")
			a1.Name = "ragdollAttachment"
			a0.Parent = part0
			a1.Parent = part1

			a0.Position = w.C0.Position
			a1.Position = w.C1.Position

			b.Parent = part0

			b.Attachment0 = a0
			b.Attachment1 = a1
			w.Enabled = false
		end
	end
end

Any help is appreciated!

SOLVED: It was not a physics bug. it was me. always me. I forgot to implement the check to verify that there is no extra BallSocketConstraints in the model, which causes the player to freak out. it works perfectly now!

2 Likes

Is this ragdoll script very laggy? Could I implement to my game? I always wanted a ragdoll like this in my tornado game.

nope, its very smooth, it runs the physics on the server automatically. I am willing to share the script(s) but it will need a lot of adjustments. It works with r15 and r6.

video:

Wow, it’s very smooth and nice.

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