You need something called math.randomthis will generate a random number. It does require some numbers to be added. For example: math.random(minnum, maxnum)
local randomnum = math.random(1, 4)
print(randomnum)
So in your script you could do:
local codes = {"xYxx28","7882qR","99212x","ui1123","sOap12","1337qw","723OpQ"}
randomnum = math.random(1, #codes)
print(codes[randomnum])
Then you can use this randomnumber as a directory for the table value. Similar to finding items in a workspace using [] allows you to search through something inside this item with that value.
If this helped make sure to click accept answer and thumbs up for others, if you need more info just ask!
1 comment
I a bit confused about math.random but thank for explaining it Bman here a Point.