Lighting properties issue

I’m trying to make a weather module that would change the weather after a set amount of time.
Sieppaa

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”:
bruhh

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 :slight_smile:

1 Like

This may have something to do with it.

Color3.new() takes 3 parameters, each being a decimal value between 0 and 1 inclusive. I believe you are trying to do it between 0 and 255. To achieve it between 0 and 255, you need to use fromRGB instead of .new()

i.e.

lighting.ColorShift_Top = Color3.fromRGB(89, 90, 158)
lighting.OutdoorAmbient = Color3.fromRGB(75, 82, 126)
2 Likes

Thank you very much for your response. It fixed the issue. I don’t understand the magic behind this but I am grateful because it works : D (sorry for late response)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.