function module.Ragdoll(chr, tim)
if chr:HasTag(“Ragdoll”) or chr:HasTag(“Armor”) then return end
task.spawn(function()
local hum = chr.Humanoid
local rootPart = chr:FindFirstChild(“HumanoidRootPart”)
hum.PlatformStand = true
chr.Humanoid.RequiresNeck = false
hum.AutoRotate = false
chr:AddTag("Ragdoll")
--chr:AddTag("IF")
for _, v in chr:GetDescendants() do
task.spawn(function()
if v:IsA("Motor6D") and v.Name ~= "RootJoint" then
v.Enabled = false
local socket = Instance.new("BallSocketConstraint")
local a1 = Instance.new("Attachment")
local a2 = Instance.new("Attachment")
a1.Parent = v.Part0
a2.Parent = v.Part1
socket.Name = v.Name
socket.Parent = v.Parent
socket.Attachment0 = a1
socket.Attachment1 = a2
a1.CFrame = v.C0
a2.CFrame = v.C1
socket.LimitsEnabled = true
socket.TwistLimitsEnabled = true
socket.UpperAngle = 20
socket.MaxFrictionTorque = 1
socket.Restitution = 0
socket.Enabled = true
game.Debris:AddItem(socket, tim - .01)
game.Debris:AddItem(a1, tim - .01)
game.Debris:AddItem(a2, tim - .01)
task.delay(tim - .01, function()
v.Enabled = true
end)
elseif v:IsA("BasePart") and v.Parent == chr then
local colpart = Instance.new("Part")
colpart.Parent = v
local weld = Instance.new("Weld")
weld.Parent = colpart
weld.Part0 = v
weld.Part1 = colpart
colpart.Size = v.Size
colpart.Transparency = 1
colpart.Massless = true
colpart.Anchored = false
game.Debris:AddItem(colpart, tim - .01)
end
end)
end
hum.Changed:Connect(function()
if hum.PlatformStand == false then return end
hum.AutoRotate = false
end)
task.delay(tim, function()
hum:SetStateEnabled(Enum.HumanoidStateType.FallingDown, false)
hum:ChangeState(Enum.HumanoidStateType.GettingUp)
hum.PlatformStand = false
chr.Humanoid.RequiresNeck = true
hum.AutoRotate = true
if hum.Health >= 1 then
rootPart.CFrame = CFrame.lookAt(Vector3.zero, rootPart.CFrame.RightVector:Cross(-Vector3.yAxis)) + rootPart.Position
end
task.wait(.25)
chr:RemoveTag("Ragdoll")
--chr:RemoveTag("IF")
end)
end)
end
hi fellow scripters. this is the ragdoll script i made. it basically disables motor6ds and adds ballsockets. but it dont work for arms for some reason. any help will be appreciated