BrickColor (Property): Difference between revisions
From Legacy Roblox Wiki
Jump to navigationJump to search
>Camoy Example templates |
>NXTBoy Fixed |
||
Line 1: | Line 1: | ||
{{CatUp|Properties}} | {{CatUp|Properties}} | ||
<onlyinclude>{{Property| | <onlyinclude>{{Property | ||
name = BrickColor | |name = BrickColor | ||
|property = [[Scripting#BrickColor|BrickColor]] BrickColor | |property = [[Scripting#BrickColor|BrickColor]] BrickColor | ||
|description = Stores the color of the object. | |description = Stores the color of the object. | ||
|object = | |object = BasePart | ||
}}</onlyinclude> | |||
{{clear floats}} | |||
== Comparison == | == Comparison == |
Revision as of 16:32, 24 December 2010
BrickColor | |
Property | BrickColor BrickColor |
Description | Stores the color of the object. |
Member of | BasePart |
Comparison
To compare the property BrickColor with the name of a color, you need to index the 'Name' property of the BrickColor. That will convert the BrickColor to a string. Even though this script below does output the name of the color, you cannot compare a color and a string.
Example
print(otherPart.Parent.Torso.BrickColor)
Example
Example
function onTouched(otherPart) print(otherPart.Parent.Torso.BrickColor) -- Outputs the name of the color if otherPart.Parent.Torso.BrickColor == "Bright red" then -- This will not match print("Never gets executed") elseif otherPart.Parent.Torso.BrickColor.Name == "Bright red" then -- This will match print("Match occurred") end end