I want to make a part that changes colors heres my script.
part = game.Workspace.Part
wait(400)
part.BrickColor = Color3.new("Really green")
I want to make a part that changes colors heres my script.
part = game.Workspace.Part
wait(400)
part.BrickColor = Color3.new("Really green")
Colors in ROBLOX are special. Typically, to represent a color value in ROBLOX you'd use the Color3.new constructor which returns a userdata that represents the R, G, B values between 0 and 1 (with a step of 1/255, but you don't have to worry about that for now).
With that said, it should be clear that saying something like Color3.new("String value") is invalid, since it must take the R, G, B arguments (Red, Green, Blue), which must be numbers.
BrickColors are different. Instead of them using the Color3.new constructor, they use a constructor called BrickColor.new. This will return the specified BrickColor that you want the part to have. You can even convert Color3 values to BrickColor values, and vise versa. However you should note when doing this, you're limited to the predefined BrickColor table of colors.
In conclusion, your revised code should look like this:
local part = workspace.Part
part.BrickColor = BrickColor.new("Really green")
You also don't need a wait in between, just make sure your part exists. If you have any questions, just let me know.
This discussion is preserved as it was. New answers, comments, and votes are closed.
3 comments
We need to take a moment right here to appreciate and upvote this answer.
I'm a firm believer in showing off, but this is crossing the line.
Ohhh Okay. Thank you alot :D I'm trying to make a bunch of games to improve my scripting. Thank you!