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

Help with indexing instances?

Asked by 9 years ago

Why is this the loop on line 18 failing to make the "Right Arm" weld and why is it not being put in the table(the output prints table: 1EB7C178 )?How could I fix this problem and why is it doing this?

Player = game.Players.LocalPlayer
Character = Player.Character
Torso = Character.Torso
Mouse = Player:GetMouse()
----------------------------------------
function CharacterCheck()
    if not Character or Character.Parent == nil then
    Character = Player.CharacterAdded:wait()
    end
end
CharacterCheck()
----------------------------------------
function MakeWelds()
    local Arms = {Character["Left Arm"],
                  Character["Right Arm"]
    }
    local ArmWelds = {}
    for i,v in pairs (Arms) do
        local Weld = Instance.new("Weld",Torso)
        Weld.Name = v.Name.."Weld"
        Weld.Part0 = v
        Weld.Part1 = Torso
        ArmWelds[i] = Weld
        return ArmWelds
    end
end
Welds = MakeWelds()
print(Welds)
----------------------------------------
    LeftClick = Mouse.Button1Down:connect(function()
        print("LeftClick")
    ---Wip
    end)

Answer this question