I'm storing Colours in a table to be able to call them depending on a random number (1,3)
set up like this,
local Cols = {BrickColor.new("Bright red"),BrickColor.new("Bright yellow"),BrickColor.new("bright blue")}
and I'm calling it like this:
t.BrickColor = Cols[string.sub(thingy, 2)]
t is defined and the string.sub will always produce a number between 1-3 but it keeps throwing up the error: ServerScriptService.GEN R 8:21: bad argument #3 to 'BrickColor' (BrickColor expected, got nil) even though it is supplied. Wat. What am I missing here?
local Cols = {BrickColor.new("Bright red"),BrickColor.new("Bright yellow"),BrickColor.new("bright blue")} t.BrickColor = Cols[tonumber(string.sub(thingy, 2))]
You're not using BrickColor.new()
This is how it should look like;
local Cols = {BrickColor.new("Bright red"),BrickColor.new("Bright yellow"),BrickColor.new("bright blue")} t.BrickColor = BrickColor.new(Cols[string.sub(thingy, 2)])