I'm new to this Tables thing, the one that goes like this ["Random", 20, true]
. I just need help on one little thing.
I have the following table:
1 | a = [ 109412 , 1210542 , 24541 ] |
I want to randomly pick one number and set the script's Parent's name to that number. Would it be something like this:
1 | ab = script.Parent |
2 | ab.Name = "" ..#a |
Thanks for your help!
Tables in Lua are created using curly braces. Square braces are used to access table members.
1 | a = { 109412 , 1210542 , 24541 } |
2 | script.Parent.Name = a [ math.random(#a) ] |
u can also do
1 | a = { 109412 , 1210542 , 24541 } |
2 | script.Parent.name = a [ math.random( 1 , #a) ] |
sorry i think i fixed it
1 | a = { 109412 , 1210542 , 24541 } |
2 | ab = script.Parent |
3 | ab.Name = "" ..a [ math.random( 1 , #a) ] |