So I'm working with a point light, and I'm trying to get a glowing effect that gradually changes from one color to another.
light = script.Parent;
r =0-- math.random (0,255)
g = 0--math.random (0,255)
b = 255--math.random (0,255)
colors = {r,g,b}
function UpdateColor ()
light.Color = Color3.new (r/255,g/255,b/255)
wait (.1)
end
while wait () do
print 'stage 1'
for i = 0,50-r do
if r < 255 then
r = r + 5;
UpdateColor () -- fades to purple, this is where the color is 255,0,255
else r = 0;
UpdateColor ()
end
end
print 'stage 2'
for i = 0,50-b do -- 50 is one less than 255/5.
if b > 0 then
b = b - 5; -- this is why I divide it by 5
UpdateColor () -- fades to red, this doesn't work! Right now the color is still 255,0,255
else b = 255;
UpdateColor ()
end
end
Any and all help will be appreciated.

1 comment
Thanks. It's fixed! I'm really prone to making dumb mistakes like that, haha!