I am trying to get my script to find a random value within another folder but on like 16 where I use square brackets, it says that I attempted to index nil ([box]) with 'Q'.
local numbersentered = {}
script.Parent.BackgroundFrame.QuestionNumber.Changed:Connect(function()
local box = math.random(1,20)
print(box)
table.insert(numbersentered, box)
for i,v in pairs(numbersentered)do
if box == v then
local box = math.random(1,20)
print(box)
table.insert(numbersentered, box)
else
local text = game.ServerStorage:FindFirstChild("Questions").Q[box].Value
for i = 1, #text do
script.Parent.TextLabel.Text = string.sub (text, 1, i)
end
end
end
end)
Any help is wonderful!

3 comments
Could you give the actual error?
try Q:GetChildren()[box]
Questions is a folder, 'Q' is the name of the string values inside the folder. It goes from Q1 to Q20.