Trouble getting a parts color to be the same as another

I know its a super simple question, but I know sometimes color3 can be tricky.

Im trying to get the color from a brick and turn another brick the same color but when I attempt to do so the part is colored black.

local col = script.Parent.Parent.Part2.Color
script.Parent.Color = Color3.fromRGB(col)

trying color3.new makes the part black.
trying color3.fromrgb makes it black.
trying color3.fromhsv throws an error.

so Im a bit confused as what I should do next.

1 Like

col is a color3 value itself, you can’t use it in another one, try this instead

script.Parent.Color = col
1 Like

thanks, I had a feeling it was one of those things under my nose.

1 Like

so, I implemented this to a bigger script, however for this one its turning white and not the right color:

local origcol = script.Parent.Color
local origmat = script.Parent.Material
local mode = false
function changestate(part)
	
	local newcol = part.Color
	local newmat = part.Material
	print("part col:",newcol)
	
	if part and mode == false then
		mode = true
		script.Parent.Color = newcol
		script.Parent.Material = newmat
		print(script.Parent.Color)
	elseif mode == true then
		mode = false
		script.Parent.Color = origcol
		script.Parent.Material = origmat
	end
	
	
end

Seems to be working without any issues for me. What’s the colour and material of each part?


P1 was a regular grey part with plastic material at the beggining - that’s what it looks like after running your code.

nvm it looks like there was another script setting its color right after it changed. sorry about that.

1 Like