The title pretty much sums it up but I was wondering if it’s possible to use math.random with names instead of numbers. For example, say I wanted to make a game idea generator. How would I put the names in there if it’s not a number? I just tried this is studio and the error message was that it wasn’t a number. Obviously, when using the random function, you would put the two numbers. But is it possible to to use it with names instead?
Yes that is possible, by choosing a random index, to correct @WhitexHat’s code it should be more like this:
local namesTable = {'Name', 'Name2', 'Name3', 'Name4'};
print(namesTable[math.random(1,#namesTable])
math.random requires 2 arguments - these arguments are the range - @WhitexHat only specified 1 argument, therefore it won’t work at all or not properly.