I am receiving "attempt to index nil with 'Name'" from line 26 of my script. I've made several revisions in an attempt to try to fix the problem but now I'm completely stumped.
The script is located within a folder that contains:
Folder ("Hair") -> 3 accessories are within
IntValue ("Number")
LocalScript ("HairScript")
ImageButton ("LeftArrow")
ImageButton ("RightArrow")
TextButton ("InfoBox")
If any additional clarification is needed, please don't hesitate to ask me. All help is appreciated!
local leftArrow = script.Parent.LeftArrow
local rightArrow = script.Parent.RightArrow
local midBox = script.Parent.InfoBox
local numb = script.Parent.Number
local character = script.Parent.Parent.CharacterViewer.Character
local hairFolder = script.Parent.Hair:GetChildren()
leftArrow.MouseButton1Click:Connect(function()
if numb.Value == 1 then
numb.Value = #hairFolder
else
numb.Value = numb.Value-1
end
end)
rightArrow.MouseButton1Click:Connect(function()
if numb.Value == #hairFolder then
numb.Value = 1
else
numb.Value = numb.Value+1
end
end)
function updateMidBox()
midBox.Text = ("Hair: "..hairFolder[numb.Value].Name)
--local hair = hairFolder[numb.Value]:Clone()
--hair.Parent = character
end
updateMidBox()

2 comments
When does this error happen? Also, could you put a print(numb.Value) in between line 25 and 26 and test it? This will make debugging easier.
The error happens at startup since updateMidBox() is called to happen as the game starts