3

# Random table choice?

NotSoNorm 777
7 years ago

I have a table but I don't understand how to pick a random number from it, How?

local Table =
{143737549,
142312040,
}

local Table


2
RM0d 305
7 years ago
local Table =
{143737549,
142312040,
}


Theres your example... without the local Table at the end (not needed)

print(Table[math.random(1,#Table)]) -- Prints a random value in A table


if you want to do stuff with use can use varirables

x = Table[math.random(1,#Table)]
script.Parent.Text = x

0
lomo0987 250
7 years ago
local Table =
{143737549,
142312040,
}

local a = math.random(1,#Table) -- This will select 1 number in table.

0
KAAK82 16
7 years ago
Table = {ur stuff in here}

pickedthings = math.random(1, #Table)
print(pickedthings)

-1

Try this

local Table=
(123456789,104050)

math.Random.Table (123456789,104050)
--do stuff
print ("..number...")


I am a noob at scripting so i don't know if this will work or not.

0
If you don't know, don't post. Azarth 3118 — 7y
0
Ok... iluvmaths1123 198 — 7y
table = {123456789,104050}