I'm trying to get my script to choose a random value from a table and then print it, but instead of text, it comes out with something like
table: 1F19D310
local messages = { "One little piggy went to market", "One little doggy went to market", "One little child went to market", "One little man went to market" } local random = messages[math.random(#messages)] print(random)
You can't local a local. Try this:
print('Test') else print('Test2') else print('Test3') else print('Test4')
I'm not that good at random variables, sorry.
Please don't down my REP ^
Answered
local messages = { "One little piggy went to market", "One little doggy went to market", "One little child went to market", "One little man went to market" } local random = math.random(1,#messages) --Forgot to choose from the table, so it would choose #messages instead of in between them print(messages[random]) --Prints it :3