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

Motor6D "Left Shoulder" and "Right Shoulder" not reconnecting arms?(SOLVED)

Asked by
films 0
10 years ago

I just made it clone the motor and reweld everything

I'm new to scripting so don't judge me So this is an animation (using cframe) when you press R problem is though, arm falls off after animation and doesn't go back to normal. Help please?

Player = game.Players.LocalPlayer
mouse = Player:GetMouse()

mouse.KeyDown:connect(function (key)
if script.value.Value == true then
if key == "r" then
script.Parent.attack.value.Value = false
script.value.Value = false
if Player.Character:FindFirstChild("Blades1") ~= nil and Player.Character:FindFirstChild("Blades2") ~= nil then
local b1 = Player.Character:FindFirstChild("Blades1")
local re1 = script.bladre:Clone()
re1.Parent = b1
Player.Character:FindFirstChild("Left Arm").Blades1:remove()
b1.Middle.Velocity = b1.Middle.CFrame.lookVector * 25
b1.Parent = game.Workspace
b1.blade.CanCollide = true
re1.Disabled = false
script.reload:Play()
local b2 = Player.Character:FindFirstChild("Blades2")
local re2 = script.bladre:Clone()
re2.Parent = b2
Player.Character:FindFirstChild("Right Arm").Blades1:remove()
b2.Middle.Velocity = b2.Middle.CFrame.lookVector * 25
b2.Parent = game.Workspace
b2.blade.CanCollide = true
re2.Disabled = false
end

if Player.Character:FindFirstChild("Blades1") == nil and Player.Character:FindFirstChild("Blades2") == nil then
 local torso = Player.Character:FindFirstChild("Torso")
    local arm1 = Player.Character:FindFirstChild("Left Arm")
    local arm2 = Player.Character:FindFirstChild("Right Arm")
    local weld1 = Instance.new("Weld" , Player.Character:FindFirstChild("Left Arm"))
    local weld2 = Instance.new("Weld" , Player.Character:FindFirstChild("Right Arm"))
    weld2.Part0 = torso
    weld2.Part1 = arm2
    weld1.Part0 = torso
    weld1.Part1 = arm1
    local ls = Player.Character:FindFirstChild("Torso"):FindFirstChild("Left Shoulder")
    local rs = Player.Character:FindFirstChild("Torso"):FindFirstChild("Right Shoulder")
ls.Part1 = nil
rs.Part1 = nil
weld1.C0 = CFrame.new(-1.5,0,0)
weld2.C0 = CFrame.new(1.5,0,0)
for i=1,12 do
weld1.C1 = weld1.C1 * CFrame.Angles(0.02,0.25,0.1)
weld1.C0 = weld1.C0 * CFrame.new(0.05,0,0)
weld2.C1 = weld2.C1 * CFrame.Angles(0.02,-0.25,-0.1)
weld2.C0 = weld2.C0 * CFrame.new(-0.05,0,0)
    wait(0.01)
end
getblades()
for i=1,10 do
weld1.C1 = weld1.C1 * CFrame.Angles(-0.1,0,0)
weld1.C0 = weld1.C0 * CFrame.new(0,0.1,-0.1)
weld2.C1 = weld2.C1 * CFrame.Angles(-0.1,0,0)
weld2.C0 = weld2.C0 * CFrame.new(0,0.1,-0.1)
    wait(0.01)
end
for i=1,10 do
weld1.C1 = weld1.C1 * CFrame.Angles(-0.1,0,0)
weld1.C0 = weld1.C0 * CFrame.new(0,0.1,0.1)
weld2.C1 = weld2.C1 * CFrame.Angles(-0.1,0,0)
weld2.C0 = weld2.C0 * CFrame.new(0,0.1,0.1)
    wait(0.01)
end
weld1.C0 = CFrame.new(1.5,0,0)
weld2.C0 = CFrame.new(-1.5,0,0)
weld1.C1 = CFrame.fromEulerAnglesXYZ(0,0,0)
weld2.C1 = CFrame.fromEulerAnglesXYZ(0,0,0)
ls.Part1 = arm1
rs.Part1 = arm2
wait(0.1)
weld1:remove()
weld2:remove()
script.value.Value = true
script.Parent.attack.value.Value = true
end


end

end
end)


function getblades()
      local g = game.StarterGui.Blades1:Clone()
                g.Parent = Player.Character
        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.Name = "Blades1"
                Y.Part0 = Player.Character["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
            if h[i].className == "Part" then
                h[i].Anchored = false
                h[i].CanCollide = false
            end
end
  local g = game.StarterGui.Blades2:Clone()
                g.Parent = Player.Character
        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.Name = "Blades1"
                Y.Part0 = Player.Character["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
            if h[i].className == "Part" then
                h[i].Anchored = false
                h[i].CanCollide = false
            end
end
end
0
Definitely new to scripting... You wrote a 100+ line script OniiCh_n 410 — 10y

Answer this question