Ho do I use math.random to pick a specific color in a table?

I want to make a table that consists of multiple specific Color3 values. Then I want to use math.random() to pick one of those specific colors. Can someone show me how to do this? I am trying to learn how to script…

so you got the array and you pick a random index and index it

ColorsArray[math.random(#ColorsArray)]
local Table = {
 Color3.new(1, 0, 1),
 Color3.new(0, 1, 0)
}

function getRandomColor()
 local index = Table[math.random(1, #Table)]
 return Table[index]
end

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.