32130, 49215, 20655
That is not a legitimate Color3 value, for those of you who don't know.
I'm writing a short script to make a color changing light, and I thought it was simple, but apparently isn't.
I wrote this very quickly, so I don't mind sharing it.
light = script.Parent; r = math.random (0,255) g = math.random (0,255) b = math.random (0,255) colors = {r,g,b} function UpdateColor () light.Color = Color3.new (r,g,b) wait (.1) end while wait () do for i,v in pairs (colors) do for i = 0,255 do if v < 255 then v = v + 5; UpdateColor () else v = 0; UpdateColor () end end end end
As for the number at the top, that's what the Color3 value becomes after I enable the script. I cannot fix it. Thanks in advance! (Color3's could be a new tag)
light.Color = Color3.new (r/255,g/255,b/255)
light = script.Parent;
function UpdateColor () r = math.random (0,255) g = math.random (0,255) b = math.random (0,255) colors = {r,g,b} light.Color = Color3.new (r,g,b) wait (.1) end while wait () do for i,v in pairs (colors) do for i = 0,255 do if v < 255 then v = v + 5; UpdateColor () else v = 0; UpdateColor () end end end end
Someone answered while I was typing, I can delete the answer if asked to
I was told in one of my previous questions that Color3 values range from 0 to 1 and not from 0 to 255. http://wiki.roblox.com/index.php/Color3
For this to work you would need to divide each value of Color3 by 255 eg:
light.Color = Color3.new (r/255,g/255,b/255)
also your for loop runs 3 times, inside that another for loop using the same variable (i) runs 256 times (consider changing i to something else). Every time it runs it will add 5 to the color (making it a
solid color again because rgb ranges from 0-1 so change this to 5/255), then showing that color (which will eventually turn white then black).