Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Making a colour sequence that fades through colours of the rainbow?

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.

3 comments

0

try :Lerp()

0

Why? He wants a ColorSequence, probably for a trail or whatever else needs ColorSequences

0

A ColorSequence would be beneficial but I don't think you can have ColorSequences when using Parts? (Unless I'm mistaken)

1 answer

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!

4 comments

0

This seems like a strong step in the right direction, but how would I actually apply this to something? Would I just use a while loop and continuously change the Color3 property to "rainbow"?

0

No, this makes a color sequence you can apply to a trail.

0

Is there any way I can apply something similar to this to a part?

0

But parts cant use colorsequences............. don't you want a ColorSequence?

This discussion is preserved as it was. New answers, comments, and votes are closed.