Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make it darker at night?

Asked by
snarns 25
7 years ago

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
0
Have it be night time, turn off all the lights, and wa-la! :D Jk. TheeDeathCaster 2368 — 7y
0
Pfth if only it were that simple lol snarns 25 — 7y

2 answers

Log in to vote
0
Answered by 7 years ago

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

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? snarns 25 — 7y
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. jamesarsenault 192 — 7y
Ad
Log in to vote
0
Answered by 7 years ago

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.

Answer this question