Hi, I’m trying to make a multiple choice test using a for loop. The questions can only appear once, and in a random order. Here’s what I go so far. Do I make 5 more for loops one for each question? I wrote the questions as “Red” “Orange” “Yellow” “Green” etc. because it will show a random picture and the player has to pick which color. What do I do next? Do I add scripts to the text buttons. This is my first time doing something like this so I have no clue.
local questions = ( {"Red",{"Red","Orange","Yellow","Green","Blue","Purple"},1} {"Orange",{"Red","Orange","Yellow","Green","Blue","Purple"}2} {"Yellow",{"Red","Orange","Yellow","Green","Blue","Purple"}3} {"Green",{"Red","Orange","Yellow","Green","Blue","Purple"}4} {"Blue",{"Red","Orange","Yellow","Green","Blue","Purple"}5} {"Purple",{"Red","Orange","Yellow","Green","Blue","Purple"}6} } local numberCorrect = 0 local NumberOfQuestions = 6 for _ = 1,NumberOfQuestions do local TempQuestionNumber = math.random(1,NumberOfQuestions) local QuestionData = questions[TempQuestionNumber] local {"Red"}, {"Red","Orange","Yellow","Green","Blue","Purple"}, 1 = unpack(QuestionData) table.remove(question,TempQuestionNumber) end --Add the other five for loops here? local percentCorrect = math.floor(numberCorrect/NumberOfQuestion * 100)
Thanks for reading
Sir.Play_MazeOfHeck