So today, I was trying to get a string value and put it in the table for I can grab it later but.
I have multiple values I want to put on the table. but when i try to print 1 it would say the text but if 2,3,4,5 its nill. is there any way to fix this
local function Find_NPC(Sting)
for _, Grab in pairs(workspace:WaitForChild("Workspace"):WaitForChild("NPC"):GetDescendants()) do
if "Name" == tostring(Sting) then
if Grab:IsA("Model") and Grab:FindFirstChildWhichIsA("Humanoid") and Grab.PrimaryPart == Grab:FindFirstChild("HumanoidRootPart") then
return Grab.Name
end
elseif "Description" == tostring(Sting) then
local List_Lines = {}
if Grab:IsA("Model") and Grab:FindFirstChildWhichIsA("Humanoid") and Grab.PrimaryPart == Grab:FindFirstChild("HumanoidRootPart")then
for _, lines in pairs(Grab.Description:GetChildren()) do
if lines.Name == "Value1" then
table.insert(List_Lines,1,Grab.Description.Value1.Value)
return List_Lines
elseif lines.Name == "Value1" and lines.Name == "Value2" then
table.insert(List_Lines,1,Grab.Description.Value1.Value)
table.insert(List_Lines,2,Grab.Description.Value2.Value)
return List_Lines
elseif lines.Name == "Value1" and lines.Name == "Value2" and lines.Name == "Value3" then
table.insert(List_Lines,1,Grab.Description.Value1.Value)
table.insert(List_Lines,2,Grab.Description.Value2.Value)
table.insert(List_Lines,3,Grab.Description.Value3.Value)
return List_Lines
elseif lines.Name == "Value1" and lines.Name == "Value2" and lines.Name == "Value3" and lines.Name == "Value4" then
table.insert(List_Lines,1,Grab.Description.Value1.Value)
table.insert(List_Lines,2,Grab.Description.Value2.Value)
table.insert(List_Lines,3,Grab.Description.Value3.Value)
table.insert(List_Lines,4,Grab.Description.Value4.Value)
return List_Lines
elseif lines.Name == "Value1" and lines.Name == "Value2" and lines.Name == "Value3" and lines.Name == "Value4" and lines.Name == "Value5" then
table.insert(List_Lines,1,Grab.Description.Value1.Value)
table.insert(List_Lines,2,Grab.Description.Value2.Value)
table.insert(List_Lines,3,Grab.Description.Value3.Value)
table.insert(List_Lines,4,Grab.Description.Value4.Value)
table.insert(List_Lines,5,Grab.Description.Value5.Value)
return List_Lines
elseif lines.Name == "Value1" and lines.Name == "Value2" and lines.Name == "Value3" and lines.Name == "Value4" and lines.Name == "Value5" and lines.Name == "Value6" then
table.insert(List_Lines,1,Grab.Description.Value1.Value)
table.insert(List_Lines,2,Grab.Description.Value2.Value)
table.insert(List_Lines,3,Grab.Description.Value3.Value)
table.insert(List_Lines,4,Grab.Description.Value4.Value)
table.insert(List_Lines,5,Grab.Description.Value5.Value)
table.insert(List_Lines,6,Grab.Description.Value6.Value)
return List_Lines
end
end
end
--elseif
end
end
end
local NPC_Description = Find_NPC("Description")
print(tostring(NPC_Description[1]))
print(tostring(NPC_Description[2]))
print(tostring(NPC_Description[3]))