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'.
01 | local numbersentered = { } |
02 |
03 | script.Parent.BackgroundFrame.QuestionNumber.Changed:Connect( function () |
04 |
05 | local box = math.random( 1 , 20 ) |
06 | print (box) |
07 | table.insert(numbersentered, box) |
08 |
09 | for i,v in pairs (numbersentered) do |
10 | if box = = v then |
11 | local box = math.random( 1 , 20 ) |
12 | print (box) |
13 | table.insert(numbersentered, box) |
14 |
15 | else |
Any help is wonderful!
ANSWER: So according to your error, it doesn't seem to have to do with box
. Your error (translated) means that :FindFirstChild("Questions")
is nil.
Note: I can't help you further until I see your hierarchy and what this
Questions
object is that you are looking for.
The full error is:
1 | 05 : 04 : 51.791 - Players.GoingToAnnoyYou.PlayerGui.ApplicationUI.QuestionScript: 16 : attempt to index nil with 'Q' |
2 | 05 : 04 : 51.791 - Stack Begin |
3 | 05 : 04 : 51.791 - Script 'Players.GoingToAnnoyYou.PlayerGui.ApplicationUI.QuestionScript' , Line 16 |
4 | 05 : 04 : 51.792 - Stack End |