Anormalboi28432

ragdoll script for roblox

Feb 17th, 2023
527
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.65 KB | Gaming | 0 0
  1. local humanoid = script.Parent:WaitForChild('Humanoid')
  2.  
  3. humanoid.BreakJointsOnDeath = false
  4.  
  5. humanoid.Died:Connect (function()
  6.     for index,joint in pairs(script.Parent:GetDescendants()) do
  7.         if joint:IsA ("Motor6D") then
  8.             local socket = Instance.new("BallSocketConstraint")
  9.             local a1 = Instance.new("Attachment")
  10.             local a2 = Instance.new("Attachment")
  11.             a1.Parent = joint.Part0
  12.             a2.Parent = joint.Part1
  13.             socket.Parent = joint.Parent
  14.             socket.Attachment0 = a1
  15.             socket.Attachment1 = a2
  16.             a1.CFrame = joint.C0
  17.             a2.CFrame = joint.C1
  18.             socket.LimitsEnabled = true
  19.             socket.TwistLimitsEnabled = true
  20.             joint:Destroy()
  21.         end
  22.     end
  23. end)
Advertisement
Add Comment
Please, Sign In to add comment