Weird syntax error

So i tried to make simple randomizer that changes part color randomly from pre-defined set of colors

After some trial & error, i almost pulled it off, but then i encountered major roadblock that i can’t resolve:

local randomnumber = math.random(1, 3)
local brick = script.Parent
a = 'One'
b = 'Two'
c = 'Three'
if randomnumber == 1 then
print (a)
brick ("Really red")
if randomnumber == 2 then
print (b)
brick ("Really blue")
if randomnumber == 3 then
print (c)
brick ("Dark green")

This line is claiming variable “brick” is incorrect by outputting: Incomplete statement: expected assignment or a function call
brick ("Really red")

You forgot to add a = between brick and


That solved that, but another problem was that i did:


While i needed to do:


brick.BrickColor ="colorhere");

Also, u can make this easier by making a table:

local randomnumber = math.random(1,3);
local colors = {
    "Really red";
    "Really blue";
    "Dark green";

brick.BrickColor =[randomnumber]);

Basically, how does colors[randomnumber] works is it will get the index from the colors table, and return the matching string.

Let’s say that randomnumber is 2, colors[2] will be "Really blue" (cause “Really blue” is second in the list)
If you don’t understand tables or indexes, you can read more about them here.

Thank you, i’ll consider that.