Ragdolling specific body part

I want to make a body part ragdoll if a raycast hits it. So if a ray were to hit a body part on the left arm, the LeftShoulder motor6d will be disabled (or destroyed) and replaced with a ball socket constraint. The code works and the arm eventually does ragdoll. I’m trying to do all this locally to give players the option to enable or disable the ragdoll effect. Cuz on the server would cause lag.

The issue is that the entire process takes like a full minute to register with the server. It looks as if the anims of the character model are resetting when being replaced.

To achieve the effect i create a ball socket constraint and set its attachment properties. This next part i tried two different ways. First is by destroying the appropriate Motor6d. This didn’t work for some reason and the motot6d stayed there. Second was by disabling the motor6ds which does work. However, doing this causes the entire character to reset which takes about 20 seconds. The arm freezes in place then snaps back onto the model and then works fine.

Main issue is the speed of the proccess. If anyone knows a better way for going about this effect do tell! I’ll be making a separate post for the deleting motor6d part tho.

function Ragdoll:LeftArm(char)
	local leftUp = char:WaitForChild("LeftUpperArm")
	local leftLow = char:WaitForChild("LeftLowerArm")
	local upTorso = char:WaitForChild("UpperTorso")
	
	local shoulderSocket = ogSocket:Clone()
	shoulderSocket.Parent = leftUp
	shoulderSocket.Attachment0 = leftUp:WaitForChild("LeftShoulderRigAttachment")
	shoulderSocket.Attachment1 = upTorso:WaitForChild("LeftShoulderRigAttachment")
	local elbowSocket = ogSocket:Clone()
	elbowSocket.Parent = leftLow
	elbowSocket.Attachment0 = leftLow:WaitForChild("LeftElbowRigAttachment")
	elbowSocket.Attachment1 = leftUp:WaitForChild("LeftElbowRigAttachment")
	

	leftUp:WaitForChild("LeftShoulder").Enabled = false
	leftLow:WaitForChild("LeftElbow"):Destroy()
	print('finish')
end

this is the function. Not that i think itll help much.

1 Like