I need to know how to make a script that can (for example) change the colour of a brick so that it will continuously cycle through the colours of the rainbow.
I'm not on about a script like this:
while true do script.Parent.BrickColor = BrickColor.new("Really red") wait(0.1) script.Parent.BrickColor = BrickColor.new("New yeller") -- etc...
I need a more in-depth script that possibly uses the Color3 property to smoothly cycle through the different hues on the spectrum of light. I've seen it done before somewhere so I know that its' possible, I just can't think of the math or wrap my head around how I would do it.
Any help would be appreciated.
I made a rainbow before. To make a color sequence, you need ColorSequenceKeypoint.new
. The first parameter is the time, the second is the color3. Or, make an array of all your colors to use them in a trail or what you are doing. Here is what I did
function GetRainbow() local red = ColorSequenceKeypoint.new(0, Color3.fromRGB(255, 0, 4)) local orange = ColorSequenceKeypoint.new(.221, Color3.fromRGB(255, 214, 47)) local yellow = ColorSequenceKeypoint.new(.401, Color3.fromRGB(251, 255, 6)) local green = ColorSequenceKeypoint.new(.566, Color3.fromRGB(28, 255, 26)) local blue = ColorSequenceKeypoint.new(.699, Color3.fromRGB(44, 93, 255)) local purple = ColorSequenceKeypoint.new(.897, Color3.fromRGB(255, 26, 252)) local finish = ColorSequenceKeypoint.new(1, Color3.fromRGB(255, 0, 213)) local rainbow = ColorSequence.new({red, orange, yellow, green, blue, purple, finish}) return rainbow end
Hope this helps!