Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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")

1 comment

0

ok

This discussion is preserved as it was. New answers, comments, and votes are closed.