Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I get a parts colour?

I'm trying to make a script that looks for a certain colour condition however I don't know how to get the colour of a part.

I also stumbled upon that there are two types of colour variables: colour and brickcolour is there any difference, if yes when should I use one and not the other?

1 answer

✓ Accepted answer

Color3 is the rgb value of the color, while BrickColor is the predefined values that you can use. example for BrickColor:

part = workspace:WaitForChild("Part")
if part.BrickColor == BrickColor.new("Really red") then
	print("Part is Really red!") else -- else print the actual part color.
	print("Part is not Really red, it is ".. tostring(part.BrickColor)..".")
end

that will print if the color of the part is what you hoped it to be, else it will print "Part is not Really red, it is " (the name of the color)

use this for Color3:

part = workspace:WaitForChild("Part")
if part.Color == Color3.fromRGB(255,0,0) then
	print("Part is Really red!") else -- else print the actual part color.
	print("Part is not Really red, it is ".. tostring(part.Color)..".")
end

thats it really lol

This discussion is preserved as it was. New answers, comments, and votes are closed.