KashTheKingYT

Ragdoll Death

Dec 9th, 2021
12,919
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.67 KB | None | 0 0
  1. local char = script.Parent
  2. local hum = char:WaitForChild("Humanoid")
  3.  
  4. hum.BreakJointsOnDeath = false
  5.  
  6. hum.Died:Connect(function()
  7.     local joints = char:GetDescendants()
  8.     for _,joint in pairs(joints) do
  9.         if joint:isA("Motor6D") then
  10.             local socket = Instance.new("BallSocketConstraint", joint.Parent)
  11.             local a0 = Instance.new("Attachment")
  12.             local a1 = Instance.new("Attachment")
  13.            
  14.             socket.Attachment0 = a0
  15.             socket.Attachment1 = a1
  16.            
  17.             a0.Parent = joint.Part0
  18.             a1.Parent = joint.Part1
  19.            
  20.             a0.CFrame = joint.C0
  21.             a1.CFrame = joint.C1
  22.            
  23.             socket.LimitsEnabled = true
  24.             socket.TwistLimitsEnabled = true
  25.            
  26.             joint:Destroy()
  27.         end
  28.     end
  29. end)
Advertisement
Add Comment
Please, Sign In to add comment