Advertisement
EconomicSerg

Roblox Ragdoll Script

Nov 3rd, 2020
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.78 KB | None | 0 0
  1. -- Make sure you are doing this in Roblox Studio please
  2. -- If you do this anywhere else other than Roblox Studio, you will get a lot of errors
  3.  
  4. game.Players.PlayerAdded:Connect(function(p)
  5.     p.CharacterAdded:Connect(function(c)
  6.         c:WaitForChild("Humanoid").BreakJointsOnDeath = false
  7.         c.Humanoid.Died:Connect(function()
  8.             for _, v in pairs(c:GetDescendants()) do
  9.                 if v:IsA("Motor6D") then
  10.                     local a0, a1 = Instance.new("Attachment"), Instance.new("Attachment")
  11.                     a0.CFrame = v.C0
  12.                     a1.CFrame = v.C1
  13.                     a0.Parent = Part0
  14.                     a1.Parent = Part1
  15.  
  16.                     local b = Instance.new("BallSocketConstraint")
  17.                     b.Attachment0 = a0
  18.                     b.Attachment1 = a1
  19.                     b.Parent = v.Part0
  20.  
  21.                     v:Destroy()
  22.                 end
  23.             end
  24.             c.HumanoidRootPart.CanCollide = false
  25.         end)
  26.     end)
  27. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement