PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience

Using Color3 to Change Colors

Using Color3 to Change Colors

Jun 23 2018, 2:01 AM PST

Problem

You want to use Color3s.

Solution

Use the Color3 table.

game.Lighting.Ambient = Color3.new(1, 0, 0)

Discussion

BrickColor values are used for bricks, however for all other types of color applications you use Color3 values which give you a bit more control of the actual color. In this case we’re setting the ambience of the light to red. The Color3 system uses RGB (red, green, blue). You can create any color by adding in different amounts of red, green, and blue.

So the arguments to Color3.new are Color3.new(red, green, blue). Now unlike most implementations of have each component be a number between 1 and 255. So (255, 255, 255) would be white, and (0, 0, 0) would be black, and (127, 127, 127) would be about mid gray. However Roblox’s implementation is a number between 0 and 1. To convert the usual implementation to Roblox’s you must do number/255. So (127, 127, 127) in the normal implementation would become (127/255, 127/255, 127/255) which is about (.5, .5, .5).

As with BrickColor you can get the individual R, G, B components of the Color3 by doing Color3.r, .g, or .b. Do note these are read only values.

Tags:
  • lighting
  • part
  • color3