Why did my ragdoll break for no reason?

So, I made a system a while back where it play an animation then the player would ragdoll and recently the ragdoll broke even though it would always work before? Can someone please tell me why my ragdoll randomly broke? This is a LocalScript just for anyone wondering. Thanks!

local Humanoid = script.Parent.Parent:WaitForChild("Humanoid")

Humanoid.BreakJointsOnDeath = false

local DA = Instance.new("Animation")

DA.AnimationId = "rbxassetid://9944817738"
local DeathAnimation = script.Parent.Parent:WaitForChild("Humanoid"):LoadAnimation(DA)

Humanoid.HealthChanged:Connect(function(Health)
	if script.Parent.Parent.Humanoid.Health  == 0 then
		script.Parent.Parent.HumanoidRootPart.Anchored = true
		DeathAnimation:Play()
		wait(0.5)
		script.Parent.Parent.HumanoidRootPart.Anchored = false
		for index,joint in pairs(script.Parent.Parent:GetDescendants()) do
			if joint:IsA("Motor6D") then
				local socket = Instance.new("BallSocketConstraint")
				local a1 = Instance.new("Attachment")
				local a2 = Instance.new("Attachment")
				a1.Parent = joint.Part0
				a2.Parent = joint.Part1
				socket.Parent = joint.Parent
				socket.Attachment0 = a1
				socket.Attachment1 = a2
				a1.CFrame = joint.C0
				a2.CFrame = joint.C1
				socket.LimitsEnabled = true
				socket.TwistLimitsEnabled = true
				joint:Destroy()
			end
		end
	end	
end)

Don’t animations not play if it’s anchored? Or am I being dumb?

Animation plays completely fine like its supposed to. All it does is anchor the root part, the ragdoll is the thing that is broken.

Yes yes, sorry, it’s 3AM I shouldn’t really be doing this lol.
Try messing with what you last touched in the code. Can you describe to me how it “breaks”? Does it just fall apart or stay in place, or something else?

Okay, so basically the players body parts just fall off like they normally would. I’m thinking that a Roblox update may of broke this, but I’m not entirely sure, and I’ve made sure to check previous copies of my game which include this and it still breaks.

You have enabled limits here, do you think the limits may have been changed in a recent update? Any errors in the console? Make sure your code isn’t formatted incorrectly.

Just a quick couple notes, use task.wait() instead of wait(), and you can completely replace index with _ when you don’t need it

There isn’t any errors in the console, I’ve made sure to check everything and I still have no clue why it broke. I’ve checked and nothing seems deprecated.

What kind of ragdoll is this? You’re supposed to structure the rig in a separate module.

Let me make a list of all the deprecated things you put in here:

  • wait
  • Humanoid.LoadAnimation

That wasn’t a very long list.


I’ve had a similar issue but with IKControls. Ragdoll scripts do not work properly for me sometimes if they do not replicate. Removing the anchor system might fix it.

Additionally, disable BreakJointsOnDeath, and just set the Enabled property of each motor to false instead of destroying. Make sure not to modify the root motor since that is important.

I think it might’ve been adaptive timestepping that broke this, but I can’t be sure.

The thing is though that the ragdoll works completely fine on the server but the only issue when I try to do it on the server is that the death animation breaks, which leads me to believe that this broke due to a Roblox update.

i asnwering too late but it may heppen due to ownership
just set it to server (primarypart dir):SetNetworkOwner(nil)

Setting the network owner to the server does not work:

Could try playing the animation on the server.

hmmmm for me it worked.Probably issue with Motors

Sorry, this post is quite old, but yeah essentially setting this script to the server worked for me.

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