#How do i make a variable that picks randomly from somewhere

15 messages · Page 1 of 1 (latest)

wind herald
#

Can anyone tell me how

pallid wagon
#

which would be

#
local thingstopick = {
  "thing1",
  "thing2",
  "thing3"
}
local randomthing = thingstopick[math.random(1,#thingstopick)
#

so it will generate a random number from 1 to however many instances is inside a table

#

then pick a random one from the table

wind herald
pallid wagon
#

you can, it will have to be for example

local thingstopick = folder:GetChildren()
#

it's still a table

wind herald
#

so uhm i do math.random?

pallid wagon
#

starting point

#

so a table contains a number of entries right

#

the first entry is table[1] basically

#

so what it does there is picks a random entry from the table