I have this fog changing coloring script, but for some reason it won't work.
1 | while wait() do |
2 | if game.Lighting.TimeOfDay = = "06:00:00" then |
3 | script.Parent.FogColor = Color 3. new( 158 , 186 , 250 ) |
4 | else if game.Lighting.TimeOfDay = = "19:00:00" then |
5 | script.Parent.FogColor = Color 3. new( 57 , 57 , 57 ) |
6 | end |
7 | end |
8 | end |
I assume that my day/night script is interfering with this script, but my lamp script I made works perfectly fine unlike this one.
01 | -- Turning On and off script |
02 |
03 | Light = script.Parent.PointLight |
04 | while wait() do |
05 | if game.Lighting.TimeOfDay = = "19:00:00" then |
06 | Light.Enabled = true |
07 | script.Parent.Material = "Neon" |
08 | else if game.Lighting.TimeOfDay = = "06:00:00" then |
09 | Light.Enabled = false |
10 | script.Parent.Material = "DiamondPlate" |
11 |
12 | end |
13 | end |
14 | end |
Any clue on how to get this Fog color change to work?
Here's the day/night script if needed:
1 | l = game:service( "Lighting" ) |
2 | while true do |
3 | l:SetMinutesAfterMidnight(l:GetMinutesAfterMidnight()+ 0.1 ) |
4 | wait(. 1 ) |
5 | end |
In Color3.new(), the values have to be divided by 255 to work, as they have to be in between 0 and 1. You could also work Color3.fromRGB(), if you prefer. You also have an extra end in the first script.
1 | while wait() do |
2 | if game.Lighting.TimeOfDay = = "06:00:00" then |
3 | script.Parent.FogColor = Color 3. new( 158 / 255 , 186 / 255 , 250 / 255 ) |
4 | else if game.Lighting.TimeOfDay = = "19:00:00" then |
5 | script.Parent.FogColor = Color 3. new( 57 / 255 , 57 / 255 , 57 / 255 ) |
6 | end |
7 | end |
Also, in the second one, instead of using strings for materials, you should use Enums. It will still work with the strings, but Enums are better to use.