Beginner Ragdoll Script

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

  1. What do you want to achieve?

A functioning ragdoll script :scream_cat:

  1. What is the issue?

Hi, this is my first post on the devforum. Hopefully this on the right topic. This is my first ragdoll script; when I reset, my body parts go crazy. I don’t know how to fix this or what I can do to fix it. The script is in startercharacterscripts.

  1. What solutions have you tried so far?

I talked to people on a scripting helpers discord and they said to change the humanoidstatetype but it didn’t work

 local char = script.Parent

char.Humanoid.BreakJointsOnDeath = false

	for _,v in pairs(char:GetDescendants()) do
		if v:IsA("Motor6D") then
			local ballsocketconstraint ="BallSocketConstraint",v.Parent)
			ballsocketconstraint.LimitsEnabled = true
			local attachment0 ="Attachment",v.Part0)
			attachment0.Name = "Attachment0"
			local attatchment1 ="Attachment",v.Part1)
			attatchment1.Name = "Attachment1"
			ballsocketconstraint.Attachment0 = attachment0
			ballsocketconstraint.Attachment1 = attatchment1

The attachment positions are messed up, which is why this might be happening. And you dont have to change the humanoids state to ragdoll.

for _, v in pairs(char:GetDescendants()) do
	if v:IsA("Motor6D") then
		local a0, a1 ="Attachment"),"Attachment")
		a0.CFrame = v.C0
		a1.CFrame = v.C1
		a0.Parent = v.Part0
		a1.Parent = v.Part1
		local b ="BallSocketConstraint")
		b.Attachment0 = a0
		b.Attachment1 = a1
		b.Parent = v.Part0
		v.Enabled = false

This, should work. Hope this helped!

1 Like

Yep it definitely helped! Thanks!

1 Like