local partconnections = { {Part0 = "LowerTorso", Part1 = "UpperTorso"}, {Part0 = "LeftUpperArm", Part1 = "LeftLowerArm"}, {Part0 = "UpperTorso", Part1 = "LeftUpperArm"}, {Part0 = "RightLowerArm", Part1 = "RightHand"}, {Part0 = "LeftLowerArm", Part1 = "LeftHand"}, {Part0 = "RightUpperArm", Part1 = "RightLowerArm"}, {Part0 = "UpperTorso", Part1 = "RightUpperArm"}, {Part0 = "LowerTorso", Part1 = "RightUpperLeg"}, {Part0 = "LowerTorso", Part1 = "LeftUpperLeg"}, {Part0 = "HumanoidRootPart", Part1 = "LowerTorso"}, {Part0 = "LeftLowerLeg", Part1 = "LeftFoot"}, {Part0 = "LeftUpperLeg", Part1 = "LeftLowerLeg"}, {Part0 = "RightUpperLeg", Part1 = "RightLowerLeg"}, {Part0 = "RightLowerLeg", Part1 = "RightFoot"}, {Part0 = "UpperTorso", Part1 = "Head"} } local function Ragdoll(c) -- c = character local model = Instance.new("Model", workspace.RagdollFolder) model.Name = c.Name for i,v in pairs(c:GetChildren()) do if v:IsA("BasePart") and v.Name ~= "Boombox" and v.Name ~= "HumanoidRootPart" then local clone = v:Clone() clone.CFrame = v.CFrame clone.Parent = model clone.Anchored = false clone.CanCollide = true if clone.Name == "Head" then if clone:FindFirstChild("BillboardBase") then clone.BillboardBase:Destroy() end if clone:FindFirstChild("face") then clone.face.Texture = "http://www.roblox.com/asset/?id=25891571" end end elseif v:IsA("Shirt") or v:IsA("Pants") or v:IsA("Humanoid") or v:IsA("BodyColors") or v:IsA("Hat") or v:IsA("Accessory") then local clone = v:Clone() clone.Parent = model end end if workspace.RagdollFolder:FindFirstChild(c.Name) then local ragdoll = workspace.RagdollFolder:FindFirstChild(c.Name) for i,v in pairs(ragdoll:GetChildren()) do if v:IsA("Hat") or v:IsA("Accessory") then for x,d in pairs(v:GetChildren()) do if d:IsA("BasePart") then local weld = Instance.new("Weld", ragdoll:FindFirstChild("Head")) weld.Part0 = ragdoll:FindFirstChild("Head") weld.Part1 = d break end end else for x,d in pairs(partconnections) do if d.Part1 == v.Name then local attach = Instance.new("Attachment", v) local attach2 = Instance.new("Attachment", ragdoll:FindFirstChild(d.Part0)) local con = Instance.new("BallSocketConstraint", attach) con.Attachment0 = attach con.Attachment1 = attach2 end end end end end end game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(char) char.Humanoid.Changed:connect(function() if char.Humanoid.Health <= 0 then Ragdoll(char) end end) end) end)
The cloned character does ragdoll, but it spazzes out all about and doesnt correctly stay in 1 spot like it should (no i'm not talking about anchoring it to make it stay still). Is there something I am doing wrong that makes it spaz out?
line 56+ Do you end up setting an offset for the attachments? I didn't see it.. Ill copy the code and see if I can figure it out.