#the ai gave me a script to change the lighting on nighttime and daytime but it doesnt seem to work

31 messages · Page 1 of 1 (latest)

dense sage
#

-- Get the Lighting service
local lighting = game:GetService("Lighting")

-- Define the time of day when you want to change the lighting
local timeOfDay = 6 -- For example, 6 represents 6:00 AM

-- Function to update the lighting based on the time of day
local function updateLighting()
if lighting.ClockTime >= timeOfDay and lighting.ClockTime < timeOfDay + 12 then
-- Set your desired lighting settings for daytime
lighting.Ambient = Color3.fromRGB(200, 200, 200)
lighting.Brightness = 2
lighting.ExposureCompensation = -0.7
lighting.Atmosphere = Color3.fromRGB(153, 153, 153)
lighting.Density = 0.3
lighting.Haze = 2.15
lighting.Glare = 0.4
-- Add more properties as needed
else
-- Set your desired lighting settings for nighttime
lighting.Ambient = Color3.fromRGB(50, 50, 50)
lighting.Brightness = 0.5
lighting.ExposureCompensation = -0.7
lighting.Atmosphere = Color3.fromRGB(127, 127, 127)
lighting.Density = 0.6
lighting.Haze = 2.15
lighting.Glare = 0.4
-- Add more properties as needed
end
end

-- Call the updateLighting function initially
updateLighting()

-- Connect the function to the ClockTime property changed event
lighting:GetPropertyChangedSignal("ClockTime"):Connect(updateLighting)

naive surge
#

my advice: dont use ai

dense sage
#

but how do i change the lighting on a specific time

mild tuskBOT
#

studio** You are now Level 1! **studio

dense sage
#

i tried finding on the website

#

nothing

naive surge
#

theres a property in lighting

dense sage
#

No like How do I change the lighting settings in game when it gets to a certain time of day?

#

like when it turns night the lighting change

naive surge
#

you have to use an if statement when the time changes

#
local nightTime = 18 -- just a guess
if lightning.ClockTime > nightTime then
   -- its night
else
   -- its day
end
tough coral
#

Check for each tick / each game change for the time, and if you want like to turn on lamps when it's night, well just check for each event

naive surge
tough coral
#

Example

local function TurnLights(time)
  if time > 18 and time < 7 then
    -- turn on
  else
    -- turn off
  end
end

-- Example of usage
RunService.HeartBeat:Connect(function()
  TurnLights(LightingService.ClockTime)
end)
naive surge
#
lightning:GetPropertyChangedSignal("ClockTime"):Connect(TurnLights
tough coral
#
-- Another example of usage
task.spawn(function()
  repeat task.wait(1)
    TurnLights...
  until not game
end)
dense sage
#

i want the fog like kinda foggy during night but i dont know how to do that

tough coral
#

There are thousands of events

tough coral
naive surge
#

atmosphere

dense sage
#

im creating a zombie game survival

naive surge
#

cool

#

good luck

dense sage
#

easy

#

game.Lighting.FogStart = 10
game.Lighting.FogEnd = 120
game.Lighting.FogColor = Color3.new(0,0,0)
game.Lighting.TimeOfDay = "00:00"

#

i made it myself

#

im smart dog

#

🤓

#

THIS TOO EASY

vale quiver