I'm trying to make a Point Light fade colours using this script:
local Red = 255 local Green = 0 local Blue = 0 local ColorValueSet = script.Parent.Parent.Parent.Part spawn(function(SetColour) while wait(0.1) do script.Parent.Parent.PointLight.Color = Color3.new(Red,Green,Blue) print(Red,Green,Blue) end end) while wait(0.1) do for i = 0,255 do wait(0.1) Green = i end wait(0.1) for i = 255,0 do wait(0.1) Red = i end for i = 0,255 do Blue = i wait(0.1) end for i = 255,0 do wait(0.1) Green = i end for i = 0,255 do wait(0.1) Red = i end for i = 255,0 do Blue = i wait(0.1) end end
The code above appears to be working properly, but for some reason, the RGB values on the actual Point Light appear to be bugged: https://gyazo.com/1c8fd40df4581d83f6f0e558687976e8
Hello xBlueSparks,
I used to have this as well. Luckily I have a fix. Color3 uses any value between 0 and 1. A workaround for this goes like this:
local Red = 255 local Green = 0 local Blue = 0 local ColorValueSet = script.Parent.Parent.Parent.Part spawn(function(SetColour) while wait(0.1) do script.Parent.Parent.PointLight.Color = Color3.new(Red/255,Green,Blue) -- Divide your values by 255, seeing as the max in RGB is 255. This doesn't have to be done when your value is 0 print(Red,Green,Blue) end end)
I hope this helps you out! If you still have questions, feel free to ask!
Regards,
DefaultAxis