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

Why Won't This Work?

Asked by 9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.
Morph = game.Morph

if script.Parent:findFirstChild("Humanoid") ~= nil and script.Parent:findFirstChild("Arm1") == nil then
        local g = Morph.Arm1:clone()
        g.Parent = script.Parent
        local C = g:GetChildren()
        for i=1, #C do
            if C[i].className == "Part" then
                local W = Instance.new("Weld")
                W.Part0 = g.Middle
                W.Part1 = C[i]
                local CJ = CFrame.new(g.Middle.Position)
                local C0 = g.Middle.CFrame:inverse()*CJ
                local C1 = C[i].CFrame:inverse()*CJ
                W.C0 = C0
                W.C1 = C1
                W.Parent = g.Middle
            end
                local Y = Instance.new("Weld")
                Y.Part0 = script.Parent["Left Arm"]
                Y.Part1 = g.Middle
                Y.C0 = CFrame.new(0, 0, 0)
                Y.Parent = Y.Part0
        end

        local h = g:GetChildren()
        for i = 1, # h do
            h[i].Anchored = false
            h[i].CanCollide = false
        end

    end

    if script.Parent:findFirstChild("Humanoid") ~= nil and script.Parent:findFirstChild("Arm2") == nil then
        local g = Morph.Arm2:clone()
        g.Parent = script.Parent
        local C = g:GetChildren()
        for i=1, #C do
            if C[i].className == "Part" then
                local W = Instance.new("Weld")
                W.Part0 = g.Middle
                W.Part1 = C[i]
                local CJ = CFrame.new(g.Middle.Position)
                local C0 = g.Middle.CFrame:inverse()*CJ
                local C1 = C[i].CFrame:inverse()*CJ
                W.C0 = C0
                W.C1 = C1
                W.Parent = g.Middle
            end
                local Y = Instance.new("Weld")
                Y.Part0 = script.Parent["Right Arm"]
                Y.Part1 = g.Middle
                Y.C0 = CFrame.new(0, 0, 0)
                Y.Parent = Y.Part0
        end

        local h = g:GetChildren()
        for i = 1, # h do
            h[i].Anchored = false
            h[i].CanCollide = false
        end

    end

    if script.Parent:findFirstChild("Humanoid") ~= nil and script.Parent:findFirstChild("Leg1") == nil then
        local g = Morph.Leg1:clone()
        g.Parent = script.Parent
        local C = g:GetChildren()
        for i=1, #C do
            if C[i].className == "Part" then
                local W = Instance.new("Weld")
                W.Part0 = g.Middle
                W.Part1 = C[i]
                local CJ = CFrame.new(g.Middle.Position)
                local C0 = g.Middle.CFrame:inverse()*CJ
                local C1 = C[i].CFrame:inverse()*CJ
                W.C0 = C0
                W.C1 = C1
                W.Parent = g.Middle
            end
                local Y = Instance.new("Weld")
                Y.Part0 = script.Parent["Left Leg"]
                Y.Part1 = g.Middle
                Y.C0 = CFrame.new(0, 0, 0)
                Y.Parent = Y.Part0
        end

        local h = g:GetChildren()
        for i = 1, # h do
            h[i].Anchored = false
            h[i].CanCollide = false
        end

    end

    if script.Parent:findFirstChild("Humanoid") ~= nil and script.Parent:findFirstChild("Leg2") == nil then
        local g = Morph.Leg2:clone()
        g.Parent = script.Parent
        local C = g:GetChildren()
        for i=1, #C do
            if C[i].className == "Part" then
                local W = Instance.new("Weld")
                W.Part0 = g.Middle
                W.Part1 = C[i]
                local CJ = CFrame.new(g.Middle.Position)
                local C0 = g.Middle.CFrame:inverse()*CJ
                local C1 = C[i].CFrame:inverse()*CJ
                W.C0 = C0
                W.C1 = C1
                W.Parent = g.Middle
            end
                local Y = Instance.new("Weld")
                Y.Part0 = script.Parent["Right Leg"]
                Y.Part1 = g.Middle
                Y.C0 = CFrame.new(0, 0, 0)
                Y.Parent = Y.Part0
        end

        local h = g:GetChildren()
        for i = 1, # h do
            h[i].Anchored = false
            h[i].CanCollide = false
        end

    end

if script.Parent:findFirstChild("Humanoid") ~= nil and script.Parent:findFirstChild("Chest1") == nil then
    local g = Morph.Chest1:clone()
    g.Parent = script.Parent
    local C = g:GetChildren()
    for i=1, #C do
        if C[i].className == "Part" then
            local W = Instance.new("Weld")
            W.Part0 = g.Middle
            W.Part1 = C[i]
            local CJ = CFrame.new(g.Middle.Position)
            local C0 = g.Middle.CFrame:inverse()*CJ
            local C1 = C[i].CFrame:inverse()*CJ
            W.C0 = C0
            W.C1 = C1
            W.Parent = g.Middle
        end
            local Y = Instance.new("Weld")
            Y.Part0 = script.Parent.Torso
            Y.Part1 = g.Middle
            Y.C0 = CFrame.new(0, 0, 0)
            Y.Parent = Y.Part0
    end
        local h = g:GetChildren()
    for i = 1, # h do
        h[i].Anchored = false
        h[i].CanCollide = false
    end
end

script:remove()

1 answer

Log in to vote
0
Answered by 9 years ago

Can you at least tell us where there's an error?

Also, try to avoid using free-modeled scripts.

Ad

Answer this question