I’m trying to make a weather module that would change the weather after a set amount of time.
When I run the game, one weather module works, but the other one causes this to happen:
robloxapp-20231027-1422589.wmv (4.2 MB)
I’ve tried searching on the Developer forum and other websites but couldn’t find anybody with the same issue. I realised that the lighting properties were all over the place when the weather changed to “pure03”:
MANAGER CODE:
local GHOULL_weather = {}
local lighting = game:GetService("Lighting")
function GHOULL_weather.setup()
GHOULL_weather:weather_cycle()
end
function GHOULL_weather:weather_cycle()
while true do
task.wait(10)
clear_lighting()
local module = require(script:GetChildren()[math.random(1, #script:GetChildren())])
GHOULL_weather:set_weather(module)
end
end
function clear_lighting()
for _, l in pairs(lighting:GetChildren()) do
l:Destroy()
end
end
function GHOULL_weather:set_weather(weather_module)
weather_module:set()
end
return GHOULL_weather
RAINY:
local GHOULL_weather_rainy = {}
local lighting = game:GetService("Lighting")
function GHOULL_weather_rainy:set()
for _, l in pairs(script:GetChildren()) do
local k = l:Clone()
k.Parent = lighting
end
lighting.Ambient = Color3.new(0, 0, 0)
lighting.Brightness = 1
lighting.ColorShift_Bottom = Color3.new(0, 0, 0)
lighting.ColorShift_Top = Color3.new(0, 0, 0)
lighting.OutdoorAmbient = Color3.new(0, 0, 0)
lighting.ShadowSoftness = 0.2
lighting.ClockTime = 14
end
return GHOULL_weather_rainy
PURE03:
local GHOULL_weather_pure03 = {}
local lighting = game:GetService("Lighting")
function GHOULL_weather_pure03:set()
for _, l in pairs(script:GetChildren()) do
local k = l:Clone()
k.Parent = lighting
end
lighting.Ambient = Color3.new(0, 0, 0)
lighting.Brightness = 3.4
lighting.ColorShift_Bottom = Color3.new(85, 99, 175)
lighting.ColorShift_Top = Color3.new(89, 90, 158)
lighting.OutdoorAmbient = Color3.new(75, 82, 126)
lighting.ShadowSoftness = 0.2
lighting.ClockTime = 14.277
end
return GHOULL_weather_pure03
all help is appreciated