How do I randomise a dictionary containing functions?

Tables (i.e. arrays) do have order.
Dictionaries (like in this person’s use case) do not.


In order to get a random function from the dictionary, you will need to use a for loop to get all the keys, then get a random key from the keys.

For example:

local Dict = {
   ["FFA"] = "function",
   ["Nothing happening"] = "function",
   ["Teamed"] = "function"
}

local Keys = {}
for key, _ in pairs(Dict) do
    table.insert(Keys, key)
end

local RandomKey = Keys[math.random(#Keys)]
local Function = Dict[RandomKey]
Function()