'Roblox Lua - Color3 expected, got string

local colorTable = {
    ('11, 13, 48'), 
    ('35, 48, 48'), 
    ('6, 47, 6'),
    ('91, 5, 7')
}

local value = math.random(1,#colorTable) 
local picked_value = colorTable[value] 
script.Parent.Background.BackgroundColor3 = picked_value

My error code was Color3 expected, got string, is there anything I can fix this? My goal was simple, randomizing a specific color rgb to a frame backrgound.



Solution 1:[1]

A Color3 object can be created by Color3.fromRGB.

local colorTable = {
    Color3.fromRGB(11, 13, 48), 
    ...
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 shingo