I have this fog changing coloring script, but for some reason it won't work.
while wait() do if game.Lighting.TimeOfDay == "06:00:00" then script.Parent.FogColor = Color3.new(158,186,250) else if game.Lighting.TimeOfDay == "19:00:00" then script.Parent.FogColor = Color3.new(57,57,57) end end 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.
-- Turning On and off script Light = script.Parent.PointLight while wait() do if game.Lighting.TimeOfDay == "19:00:00" then Light.Enabled = true script.Parent.Material = "Neon" else if game.Lighting.TimeOfDay == "06:00:00" then Light.Enabled = false script.Parent.Material = "DiamondPlate" end end end
Any clue on how to get this Fog color change to work?
Here's the day/night script if needed:
l = game:service("Lighting") while true do l:SetMinutesAfterMidnight(l:GetMinutesAfterMidnight()+0.1) wait(.1) 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.
while wait() do if game.Lighting.TimeOfDay == "06:00:00" then script.Parent.FogColor = Color3.new(158/255, 186/255, 250/255) else if game.Lighting.TimeOfDay == "19:00:00" then script.Parent.FogColor = Color3.new(57/255, 57/255, 57/255) end 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.