#ragdoll script not working?

1 messages · Page 1 of 1 (latest)

wanton lotus
#

local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")

-- Create a ragdoll joint
local function makeRagdollJoint(part0, part1)
local att0 = Instance.new("Attachment")
att0.Position = Vector3.new(0, 0, 0)
att0.Parent = part0

local att1 = Instance.new("Attachment")
att1.Position = Vector3.new(0, 0, 0)
att1.Parent = part1

local socket = Instance.new("BallSocketConstraint")
socket.Attachment0 = att0
socket.Attachment1 = att1
socket.Parent = part0

end

local function ragdoll()
-- Disable animations
local animateScript = character:FindFirstChild("Animate")
if animateScript then
animateScript.Disabled = true
end

-- Break Motor6Ds and replace with constraints
for _, obj in pairs(character:GetDescendants()) do
    if obj:IsA("Motor6D") then
        local part0 = obj.Part0
        local part1 = obj.Part1
        obj:Destroy()
        if part0 and part1 then
            makeRagdollJoint(part0, part1)
        end
    end
end

-- Unanchor all parts
for _, part in pairs(character:GetChildren()) do
    if part:IsA("BasePart") then
        part.Anchored = false
        part.CanCollide = true
    end
end

end

-- Run ragdoll on death
humanoid.Died:Connect(ragdoll)

frosty garnet
#

local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")

local function makeRagdollJoint(part0, part1)
local att0 = Instance.new("Attachment")
att0.Position = Vector3.new(0, 0, 0)
att0.Parent = part0

local att1 = Instance.new("Attachment")
att1.Position = Vector3.new(0, 0, 0)
att1.Parent = part1

local socket = Instance.new("BallSocketConstraint")
socket.Attachment0 = att0
socket.Attachment1 = att1
socket.Parent = part0

end

local function ragdoll()
-- Disable animations
local animateScript = character:FindFirstChild("Animate")
if animateScript then
animateScript.Disabled = true
end
constraints
for _, obj in pairs(character:GetDescendants()) do
if obj:IsA("Motor6D") then
local part0 = obj.Part0
local part1 = obj.Part1
obj:Destroy()
if part0 and part1 then
makeRagdollJoint(part0, part1)
end
end
end

for _, part in pairs(character:GetChildren()) do
    if part:IsA("BasePart") then
        part.Anchored = false
        part.CanCollide = true
    end
end

end

humanoid.Died:Connect(ragdoll)

#

@wanton lotus

wanton lotus
#

oh my god ive been doing it wrong the entire time

#

its been in starter player scripts instead of starter character scripts

#

and it stil doesnt work

#

i got it working

#

FINALQLY