BrickColor (Property)

From Goodblox Wiki
Revision as of 07:27, 23 June 2020 by Pizzaboxer (talk | contribs) (Created page with "{{CatUp|Properties}} {{Property| name = BrickColor |property = BrickColor BrickColor |description = Stores the color of the object |object = GBX.lu...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search


Property
Name BrickColor
Property BrickColor BrickColor
Description: Stores the color of the object
In Object: Flagstand, Part, Seat, SpawnLocation


Example

 
--[[ NOTE:  To compare the property BrickColor with the name of a color, 
you need to use tostring() to convert BrickColor to a string.  Even though 
print(otherPart.Parent.Torso.BrickColor) does return the name of the color, 
you cannot use it by itself in a comparison. ]]--

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 tostring(otherPart.Parent.Torso.BrickColor) == "Bright red" then -- This will match
        print("Match occurred")
    end
end 

See Also

Color Reference