Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make it darker at night?

I have a day/night script, but I was wondering if there's a way to change the Lighting with the time of day to make it gradually darker at night, and then lighter in the day. Is such a thing possible?

Here's my day/night script.

while wait (.5) do
	game.lighting:SetMinutesAfterMidnight(game.lighting:GetMinutesAfterMidnight() +1)
end

2 comments

0

Have it be night time, turn off all the lights, and wa-la! :D Jk.

0

Pfth if only it were that simple lol

2 answers

✓ Accepted answer

Another way to change the brightness of your place is by inserting a ColorCorrectionEffect into Lighting and adjusting the settings there. You can change the Brightness, Contrast, Saturation, and TintColor with ColorCorrection to affect how your game looks.

while wait (.5) do
	game.Lighting:SetMinutesAfterMidnight(game.Lighting:GetMinutesAfterMidnight() +1)
	if game.Lighting.TimeOfDay == "18:00:00" then
		colorCorrection = Instance.new("ColorCorrectionEffect")
		colorCorrection.Parent = game.Lighting
		colorCorrection.Brightness = 0.5
	end
	if game.Lighting.TimeOfDay == "06:00:00" then
		colorCorrection.Brightness = 0
	end
end

2 comments

0

This is nearly perfect! I've tried to change it so I use OutdoorAmbient instead of ColorCorrection, but I can't quite get it to work. Do you think you can change it so it uses OutdoorAmbient instead?

0

You can use OutdoorAmbient, though I personally prefer to use the ColorCorrection property Tint. Just instead of a number value with Brightness, use a Color3 value.

You can change the Ambient, OutdoorAmbient, and Brightness to alter how "dark" or "light" a place looks.

game.Lighting.Brightness = 0.25
game.Lighting.Ambient = Color3.new(0,0,0)
game.Lighting.OutdoorAmbient = Color3.new(0,0,0)

You would, of course, have to alter around these values to allow them to fit with your script.

This discussion is preserved as it was. New answers, comments, and votes are closed.