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

How do I make a part that slowly changes colors? (like a neon sign)

I have an idea of how it'd work, but I can't test it right now, and I'm not sure if it's efficient. Could someone critique this?

part = script.Parent
var = 0

while true do
	number = var + 1
	part.BrickColor = BrickColor.new(number,number,number)
	wait(.001)
end

3 answers

Do this:

part = script.Parent
x = math.random(1,255)
y = math.random(1,255)
z = math.random(1.255)

while true do
    part.BrickColor = Color3.new(x,y,z)
    wait(1)
end

Color3 objects will create new colors. Making it change colors would look like:

while true do
	script.Parent.BrickColor = BrickColor.Random()
	wait(1)
end

Really nice rainbow script right here.

frequency = 0.05
local rainbow = function (i)
    local r = math.sin(frequency*i + 0) * 127 + 128;
    local g = math.sin(frequency*i + (2*math.pi/3)) * 127 + 128;
    local b = math.sin(frequency*i + (4*math.pi/3)) * 127 + 128;
    
    return Color3.fromRGB(r, g, b)
end
local i = 1
while wait() do
	part.Color3 = rainbow(i)
	i = i+1
end

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