Trying to make toggleable ragdoll

I’m trying to make a toggleable ragdoll script for my game, so I use BallSockConstraint but the problem is when ragdoll is toggled player’s bodyparts will sink into the floor

https://gyazo.com/bcf104cc5a181a9fda9665812f171ba8 (player’s bodyparts sink into the floor)

Here’s my script :

for i,v in pairs(targetchar:GetDescendants()) do

  	if v:IsA("Motor6D") then									
  			
  		local Socket = Instance.new("BallSocketConstraint")
  		local a1 = Instance.new("Attachment")
  		local a2 = Instance.new("Attachment")
  		a1.Parent = v.Part0
  		a2.Parent = v.Part1
  		Socket.Parent = v.Parent
  		Socket.Attachment0 = a1
  		Socket.Attachment1 = a2
  		a1.CFrame = v.C0
  		a2.CFrame = v.C1
  		Socket.LimitsEnabled = true
  		Socket.TwistLimitsEnabled = true
  						
  		v.Enabled = false								
  		
  	end
  end		

ps: I tried Tom_atoes Ragdoll Module but it got alot of bug.

2 Likes

You have to send a remote event to the ragdolled client and tell their humanoid to turn on ragdoll state and set getup state to false, then reverse it when unragdolling

2 Likes