Why is my ragdoll flying?
heres my code
local ps = game:GetService("PhysicsService")
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
character.Humanoid.BreakJointsOnDeath = false
character.Humanoid.HealthDisplayType = Enum.HumanoidHealthDisplayType.AlwaysOff
character.Humanoid.NameDisplayDistance = 0
character.Archivable = true
character.Humanoid.Died:Connect(function()
local character2 = character:Clone()
character2.Parent = workspace.Ragdolls
-- Create ragdoll
for _, v in pairs(character2:GetDescendants()) do
if v:IsA("Motor6D") then
v.Parent.Anchored = true
v.Parent.CanCollide = true
local a0,a1 = Instance.new("Attachment"),Instance.new("Attachment")
a0.CFrame = v.C0
a1.CFrame = v.C1
a0.Parent = v.Part0
a1.Parent = v.Part1
local b = Instance.new("BallSocketConstraint")
b.Attachment0 = a0
b.Attachment1 = a1
b.Parent = v.Part0
v.Parent.Anchored = false
v:Destroy()
elseif v:IsA("Part") or v.Name == "Handle" then
ps:SetPartCollisionGroup(v, "Ragdolls")
v.CanCollide = true
elseif v:IsA("Script") or v:IsA("LocalScript") then
v:Destroy()
elseif v:IsA("Attachment") then
v:Destroy()
end
end
for _, item in pairs(character:GetChildren()) do
if item:IsA("MeshPart") then
item:Destroy()
elseif item:IsA("Accessory") then
item:Destroy()
end
end
end)
end)
end)