I have this script:
local teamstable = {
Teams = {
[1] = {
Name = "Inmate",
Description = game.Teams.Inmate.MenuStats.Description.Value
},
[2] = {
Name = "Max Security Inmate",
Description = game.Teams["Max Security Inmate"].MenuStats.Description.Value
},
[3] = {
Name = "Supermax Inmate",
Description = game.Teams["Supermax Inmate"].MenuStats.Description.Value
},
[4] = {
Name = "Medical Staff",
Description = game.Teams["Medical Staff"].MenuStats.Description.Value
},
[5] = {
Name = "Facility Security",
Description = game.Teams["Facility Security"].MenuStats.Description.Value
},
[6] = {
Name = "Nervex Security",
Description = game.Teams["Nervex Security"].MenuStats.Description.Value
},
[7] = {
Name = "Emergency Response Team",
Description = game.Teams["Emergency Response Team"].MenuStats.Description.Value
},
[8] = {
Name = "Prison Administration",
Description = game.Teams["Prison Administration"].MenuStats.Description.Value
},
[9] = {
Name = "Prison Command",
Description = game.Teams["Prison Command"].MenuStats.Description.Value
},
[10] = {
Name = "CPU",
Description = game.Teams.CPU.MenuStats.Description.Value
},
[11] = {
Name = "Special Forces",
Description = game.Teams["Special Forces"].MenuStats.Description.Value
},
[12] = {
Name = "Military Police",
Description = game.Teams["Military Police"].MenuStats.Description.Value
},
[13] = {
Name = "Hostile Forces",
Description = game.Teams["Hostile Forces"].MenuStats.Description.Value
},
[14] = {
Name = "Moderation Team",
Description = game.Teams["Moderation Team"].MenuStats.Description.Value
},
[15] = {
Name = "Prison Intelligence",
Description = game.Teams["[EXPUNGED]"].MenuStats.Description.Value
},
[16] = {
Name = "Government Staff",
Description = game.Teams["Government Staff"].MenuStats.Description.Value
},
[17] = {
Name = "Engineering & Technical",
Description = game.Teams["Engineering and Technical"].MenuStats.Description.Value
},
}
}
wait(20)
for i, val in pairs(teamstable.Teams[15]) do
print(val.Description)
end
And when the 20 second wait is over, it prints nil (x2)
How can I fix this?

5 comments
val already refers to the attributes Name & Description during iteration, as you're traversing through the contents of teamtable.Teams[15]. Simply running print(val) will reveal the content, or by directly indexing the description element: teamtable.Teams[15].DescriptionÂ
try print(i) instead of print(val.Description)
the way you have it setup, each index inside Teams is a table, so you're looping through the 15th table so to get whats inside the table, use the 2 indexes inside (Name and Description). The associated value for each index is what it's equal to.
why are you looping when you could do print(teamstable.Teams[15].Description)
^