When I attempt to change game.Lighting.Fogcolor with a script the color3 values change to 65025.
Like if were to do this:
game.Lighting.FogColor = Color3.new(255, 0, 255)
The color 3 will change to 65025, 0, 65025 and create an extremely intense fog the same color as intended (in this case magenta).
I'm not sure if this is a bug as it only recently started happening in my game. It would be great if anyone knows how to fix this. Thanks in advance.
The issue in this code is that Color3.new()
expects numbers ranging from 0-1. Most people write in RGB values (0-255), so if you want to continue to do that, you can either divide each value by 255 or use Color3.fromRGB()
.
game.Lighting.FogColor = Color3.fromRGB(255,0,255)
or
game.Lighting.FogColor = Color.new(1,0,1) --because 255/255 is 1
Your intensity issue is probably being caused by something else, however. Check your FogEnd
property and see if it's too low!
Ok, so after some digging on the developer wiki I have found that color3.new can only range from only 0 to 1.
Returns a Color3 with the given red, green, and blue values. The numbers can range from 0 to 1.
So instead I would have to use color3.fromRGB which can use the 0 - 255 range I was trying to use.
I know it! Use this
game.Lighting.FogColor = Color3.new(123/255, 45/255, 67/255)
You can change 123, 45 and 67, and that will set FogColor to the expected numbers