How would I make a stringvalue (brickcolor) into a color3 for a gui

  1. What do you want to achieve? I am trying to make a gui’s color equal to a random color from a table (which I made = to a string value) now I want to make that = to a gui’s backgrouncolor3

  2. What is the issue? I have no idea how to do it

  3. What solutions have you tried so far? Yes everywhere

The main script for changing it

function findBricks(ColorParts)
	local ChosenColor = BrickColors[math.random(1, #BrickColors)]
	for _,v in pairs(ColorParts:GetDescendants()) do
		if v:IsA("BasePart") and v.BrickColor ~= BrickColor.new(ChosenColor) then
			v.Transparency = 1
			v.CanCollide = false
		end
		ColorValue.Value = ChosenColor
	end
end

(The string value does change)

you can convert brickcolor to color3 using brickcolor.Color

I tried that but it doesnt work, would I need a local script?

you forgot to make a Brickcolor object so you are just giving it a string of text, what you should do is the same that you did in the if statement:
ColorValue.Value = BrickColor.new(ChosenColor).Color
it doesn’t need to be in a local script

3 Likes