Ad
Log in to vote
0

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

Asked by 3 months ago

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

Log in to vote
0
Answered by 3 months ago

https://twitter.com/ToastedFridays/status/954113059705860096

Ad
Log in to vote
0
Answered by 3 months ago
Edited 3 months ago

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
Log in to vote
0
Answered by
Fifkee 143
3 months ago

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

Answer this question