Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Ragdoll via glue not working properly???

Asked by 9 years ago

I've been working on a ragdoll script with a custom player model. Ive already got all the body parts (not any from the original roblox character) to unanchor and fall fine, but I am having trouble with attaching each body part. Right now im trying to use glue, but it doesnt work and the body parts fly in every direction. Does anyone know if theres a better way than glue, or if im doing something wrong?

Here it is:

function ragDoll()
    _G.canShoot = false;

    dead = true;
    game:GetService("RunService"):UnbindFromRenderStep("Camera")
    char:FindFirstChild("Left Arm"):Destroy()
    char:FindFirstChild("Right Arm"):Destroy()
    char:FindFirstChild("Left Leg"):Destroy()
    char:FindFirstChild("Right Leg"):Destroy()
    for i,v in pairs(char.leftArm:GetChildren()) do
        if v.ClassName == "Part" or v.ClassName == "UnionOperation" then
            v.CanCollide = true;
        end
    end
    for i,v in pairs(char.rightArm:GetChildren()) do
        if v.ClassName == "Part" or v.ClassName == "UnionOperation" then
            v.CanCollide = true;
        end
    end
    for i,v in pairs(char.leftLeg:GetChildren()) do
        if v.ClassName == "Part" or v.ClassName == "UnionOperation" then
            v.CanCollide = true;
        end
    end
    for i,v in pairs(char.rightLeg:GetChildren()) do
        if v.ClassName == "Part" or v.ClassName == "UnionOperation" then
            v.CanCollide = true;
        end
    end
    char.falseHead.head.CanCollide = true;
    char.torso.CanCollide = true;
    char.Torso.torso:Destroy()
    char.HumanoidRootPart:Destroy()
    dumpCam()
    char.Head.CanCollide = false;
    char.torso.BodyGyro:Destroy()
    char:FindFirstChild("CZ Scorpion"):Destroy()
    local glue1 = Instance.new("Glue")
    glue1.Parent = char.torso;
    glue1.Part0 = char.torso;
    glue1.Part1 = char.leftArm.upperArm;

    local glue2 = Instance.new("Glue")
    glue1.Parent = char.torso;
    glue1.Part0 = char.torso;
    glue1.Part1 = char.rightArm.upperArm;

    local glue3 = Instance.new("Glue")
    glue1.Parent = char.torso;
    glue1.Part0 = char.torso;
    glue1.Part1 = char.leftLeg.upperLeg;

    local glue4 = Instance.new("Glue")
    glue1.Parent = char.torso;
    glue1.Part0 = char.torso;
    glue1.Part1 = char.rightLeg.upperLeg;

    local glue5 = Instance.new("Glue")
    glue1.Parent = char.torso;
    glue1.Part0 = char.torso;
    glue1.Part1 = char.falseHead.head;
end

Answer this question