b = Instance.new("TextButton") b.Name = deptlist[i].Name b.BorderSizePixel = 0 b.BackgroundTransparency = 1 print(BrickColor.new(deptlist[i].Color).Color) b.BackgroundColor3 = Color3.new(BrickColor.new(deptlist[i].Color).Color) b.Text = string.upper(deptlist[i].Name) b.TextSize = 50 b.TextScaled = true b.TextXAlignment = "Left" b.TextColor3 = Color3.new(255,255,255) b.Parent = teams.Selection
deptlist[i].Color is a brickcolor
here is the module script
return { { ["Name"] = "Indian Citizen"; ["Tag"] = "Citizen"; ["Color"] = "Deep orange"; ["GroupId"] = 919408; }; };
Color3.new()
can only take a number in each value (x,y,z) from 0 to 1. You must be giving it higher than that range, which forces the color to be black. In order to make the desired color appear, use Color3.fromRGB()
:
b.BackgroundColor3 = Color3.fromRGB(BrickColor.new(deptlist[i].Color).Color) -- This should fix the problem
Color3.fromRGB()
works because its range is from 0 to 255, making it easier to create colors.
So I found the answer by experimenting and I figured out (after way too long) that the
color = BrickColor.new(deptlist[i].Color).Color
gives out a color3
So when you change the background color, you do not need to add color3.new(), just color like this
b.BackgroundColor3 = BrickColor.new(deptlist[i].Color).Color