Random Generated Weather System Not Working

Hello, so I have been working on a system but It doesn’t really appear to work nor error in the output, if I had done something wrong please tell what did I do, here is the code.

local _settings = require(script._settings)
local WeatherHistory = {}
local Lighting = game:GetService("Lighting")

while wait(_settings.wait_time) do
	local random_weather = math.random(1, 3)
	
	if random_weather == 1 then   -- Sunny
		game.Lighting.Blur.Enabled = false
		game.Lighting.SunRays.Enabled = true
		game.Lighting.ColorCorrection.Enabled = false
		
		table.insert(WeatherHistory, "Sunny")
	end
	
	if random_weather == 2 then   -- Rainy
		game.Lighting.Blur.Enabled = false
		game.Lighting.SunRays.Enabled = true
		game.Lighting.ColorCorrection.Enabled = false
		
		game.Workspace.VFX.Snow.RainEmitter.Enabled = true
		game.Lighting.FogEnd = _settings.Lighting.Fog
		game.Lighting.FogColor = Color3.new(111, 111, 111)
		table.insert(WeatherHistory, "Rain")
	end
	
	if random_weather == 3 then   -- Snowy
		game.Lighting.Blur.Enabled = true
		game.Lighting.SunRays.Enabled = false
		game.Lighting.ColorCorrection.Enabled = true
		
		game.Workspace.VFX.Snow.SnowEmitter.Enabled = true
		game.Lighting.FogEnd = _settings.Lighting.Fog
		table.insert(WeatherHistory, "Snowy")
	end
	print(random_weather)
end

Try adding prints throughout your entire script to narrow a issue down to a line

1 Like

What is this “_settings.Lighting.Fog” IntValue?? or there is module script?

Can you send screenshot about inside of your script?