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

attempt to index nil with 'LeftLowerLeg'? What does this mean?

Asked by 4 years ago

I'm making ice skates for my game and I'm trying to get them on the player but this pops up, "attempt to index nil with 'leftlowerleg'. I don't get it. Here is the part of my script that has it.

                local Y = Instance.new("Weld")
                Y.Part0 = player.Character.LeftLowerLeg
                Y.Part1 = g.Middle
                Y.C0 = CFrame.new(0, 0, 0)
                Y.Parent = Y.Part0

here is the whole script

local Skate = workspace.IceSkates
game.Players.PlayerAdded:connect(function(player)
    local g = Skate.Leg1: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.Part0 = player.Character.LeftLowerLeg
                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


        local g = Skate.Leg2: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.Part0 = player.Character.RightLowerLeg
                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
end)


1 answer

Log in to vote
0
Answered by 4 years ago

It is not finding the "LeftLowerLeg" it is saying that that is a weird thing that I don't know what it is. Maybe try this:

player.Character:FindFirstChild("LeftLowerLeg")
0
ok Nervousmrmonkey2 118 — 4y
Ad

Answer this question