Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Table not printing?

Asked by 9 years ago

Hello scripting helpers,

I am trying to make the table print all questions into the console and then trying to pick a random question.

I tried to read http://wiki.roblox.com/index.php?title=Table but I find it so confusing so I tried to do it myself.

Here is the script I created:-

local Questions = { -- Creates table
    ["1"] = "Question) what is..", -- Question 1
    ["2"] = "Question) where is..", -- Question 2
    ["3"] = "Question) in the.." -- Question 3
}

print (Questions) -- Prints table: 1E15**** When it's supposed to print all the questions. I changed the last numbers and letters if there is some security password encryption thing ;_; sorry, I have no clue what that was.


local questions = (Questions)
local randomquestion = questions[math.random(1, #questions)]  -- Errors 
print (randomquestion)

Here is the error on line 11:-

ServerScriptService.Script:11: attempt to get length of local 'questions' (a nil value)

Would you be able to help? :] Thanks! Nathan.

Answer this question