How do I make math.random print a string

Viewed 61

how do you make math.random print a string and not an int value from a table.

this is some of the code I wrote

local Menu = {"","",""}

local Item = math.random(1,#Menu)

print(Item)

Sorry if this is a question if like everyone knows. I just started scripting about 6 days ago. I coudnt find the answer anywhere on google so I decided to come here.

1 Answers

You are close: using print(Menu[Item]) should do what you need.

You can also use math.random(#Menu), as it's the same as math.random(1,#Menu).

Related