i want to change the color of a part to yellow but This code does not work:
part.BrickColor = BrickColor.Yellow
i also used this code but still not working:
part.BrickColor = Color3.new(255, 255, 0)
please help
You have to put open and closed brackets by Yellow. Like this:
part.BrickColor = BrickColor.Yellow()
You need to define part
:
local part = workspace.Part --or part = workspace.Part
Also, BrickColor doesn't accept Color3s, so if you used Color3:
part.Color = Color3.new() -- you could also use Color3.fromRGB() or Color3.fromHSV()
And for BrickColor:
part.BrickColor = BrickColor.new()
When setting the Color of a part you have 2 options. 1. Use BrickColor or 2. Use Color3.
When using BrickColor you'd write something like this: Part.BrickColor = BrickColor.new('New Yeller')
Where as when you are using Color3 you again have a couple of options. I personally prefer and recommend using RGB as it is simple to understand. Part.Color3 = Color3.fromRGB(255,255,0) Or you do Part.Color3 = Color3.new(1,1,0)
When you use Color3.new rather than Color3.fromRGB you are working in numbers from 0 to 1 rather than 0 to 255.