Hello! Is there any way to tone down the map’s brightness at light? The moonlight much brighter than I’d like it to be (as shown in the screenshot below), is there a way to disable it or at least tone it down? It feels as if there’s no need to even have street lights with this much brightness. I have a day/night cycle in my game, so I don’t really want to make any changes to the atmosphere as to keeping the daytime lighting looking the same as it does now (as shown the 2nd screenshot below). I’m not certain whether this is how the moonlight’s supposed to look by default or whether I may have accidentally altered it to look like this, since I did insert a skybox from the toolbox.
I think you could edit the ambience colors and play around with the brightness for this, they’re in lighting. Not a lighting expert but from my experience that’d work.
Try this, putting it inside your day night cycle assuming it is ran on the server, and days last around 5 minutes :
while true do
task.wait(2)
if game.Lighting.ClockTime < 6 or game.Lighting.ClockTime >= 18 then
game.Lighting.Brightness -= 0.01
else
game.Lighting.Brightness += 0.01
end
Actually, I think it will work in local script too. Btw, also put this in a coroutine or task.spawn if the task.wait does not match with your day night cycle script.
-- Reference to the Lighting service
local Lighting = game:GetService("Lighting")
-- Define the brightness values
local maxBrightness = 2
local minBrightness = 0
-- Define the color transitions (using Color3 values)
local nightColor = Color3.fromRGB(0, 50, 70) -- Blue for night (0 AM)
local sunriseColor = Color3.fromRGB(162, 116, 70) -- Orange for sunrise (6 AM)
local middayColor = Color3.fromRGB(255, 255, 255) -- White for midday (12 PM)
local sunsetColor = Color3.fromRGB(238, 176, 105) -- Orange for sunset (4 PM)
-- Function to calculate the brightness and color based on the time of day
local function updateLighting()
local currentTime = Lighting.ClockTime -- Get the current time (0 to 24)
-- Calculate brightness based on the time of day
local brightness
if currentTime >= 0 and currentTime < 12 then
-- Increasing brightness from 0 to 12 PM
local percentage = currentTime / 12 -- Normalize time to a percentage from 0 to 1
brightness = minBrightness + (maxBrightness - minBrightness) * percentage
else
-- Decreasing brightness from 12 PM to 12 AM
local percentage = (24 - currentTime) / 12 -- Normalize time to a percentage from 0 to 1
brightness = minBrightness + (maxBrightness - minBrightness) * percentage
end
-- Calculate the color transition based on time as a continuous gradient
local color
if currentTime >= 0 and currentTime < 6 then
-- Transition from Blue (0 AM) to Orange (6 AM)
local percentage = currentTime / 6 -- Normalize time from 0 to 1
color = nightColor:Lerp(sunriseColor, percentage)
elseif currentTime >= 6 and currentTime < 12 then
-- Transition from Orange (6 AM) to White (12 PM)
local percentage = (currentTime - 6) / 6 -- Normalize time from 0 to 1
color = sunriseColor:Lerp(middayColor, percentage)
elseif currentTime >= 12 and currentTime < 17.5 then
-- Transition from White (12 PM) to Orange (4 PM)
local percentage = (currentTime - 12) / 5.5 -- Normalize time from 0 to 1 (12 PM to 4 PM)
color = middayColor:Lerp(sunsetColor, percentage)
elseif currentTime >= 17.5 and currentTime < 18 then
-- Transition from Orange (4 PM) to Blue (6 PM)
local percentage = (currentTime - 17.5) / 0.5 -- Normalize time from 0 to 1 (4 PM to 6 PM)
color = sunsetColor:Lerp(nightColor, percentage)
elseif currentTime >= 18 and currentTime < 24 then
-- Stay at Blue (6 PM to 12 AM)
color = nightColor
end
-- Apply the calculated brightness and color to the Lighting service
Lighting.Brightness = brightness
Lighting.OutdoorAmbient = color
Lighting.ColorShift_Top = color
end
-- Update the lighting every second
while true do
updateLighting()
wait() -- Update every 1 second
end