How can I do addition or subtraction in RGB colors?

So I’ve been trying to do addition for colors (for the lighting to change smoothly during a for loop). If you have tried this you know it errors, (the error basically says that you can’t do addition for colors) is there any way to do addition or subtraction in Color3.fromRGB?? Here’s what I got for now so you can try it (it just errors…) :

for i = 1, 30 do
    game.Lighting.OutdoorAmbient = game.Lighting.OutdoorAmbient + Color3.fromRGB(1,1,1)
    wait()
end
1 Like

Why not try having 3 variables for RGB color and simply doing the addition/subtraction on those. You can then set the color3.fromRGB to those numbers.

Kind of like this:

local R,G,B = 1,1,1;

for i = 1, 30 do
	R,G,B = R+1, G+5, B+3; -- add or subtract whatever amount you want
	game.Lighting.OutdoorAmbient =  Color3.fromRGB(R,G,B); -- set the color
	wait();
end;
1 Like