What is the issue? I am not experienced in coding and therefore do not know how to make or edit a script to make this feature.
What solutions have you tried so far? I tried editing this script but I could not get it to work.
That script
local timetoturnon = 7 * 60 --multiply the hour to minute
local timetoturnon = 23*60 --same
game.Lighting:GetPropertyChangedSignal("ClockTime"):Connect(function()
if game.Lighting:GetMinutesAfterMidnight() > timetoturnoff and game.Lighting:GetMinutesAfterMidnight() < timetoturnon then
--so If time is currently after 7 am and before 23 o'clock the light will be off
for _, v in pairs(script.Parent.Parkinglotlightparts:GetChildren()) do
v.LightPart.SpotLight.Enabled = false
end
else
for _, v in pairs(script.Parent.Parkinglotlightparts:GetChildren()) do
v.LightPart.SpotLight.Enabled = false
end
end
end)
lets assume you know the basics; if you’re using the terrain clouds it’d be better just to tween down their density and cover after it hits a certain time.
You should not delete and reclone it, That’s bad for perfomance, And that script of mine was old
local timetoturnon = 7 * 60 --multiply the hour to minute
timetoturnon = 23*60 --same
game.Lighting:GetPropertyChangedSignal("ClockTime"):Connect(function()
if game.Lighting:GetMinutesAfterMidnight() > timetoturnoff and game.Lighting:GetMinutesAfterMidnight() < timetoturnon then
--so If time is currently after 7 am and before 23 o'clock the light will be off
game.workspace.Terrain.Clouds.Enabled = false
else
game.workspace.Terrain.Clouds.Enabled = true
end
end)
Should be in a local script for better performance,It shouldn’t be a problem if an exploiter disables it
local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(10, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)
local clouds = workspace:WaitForChild("Terrain"):WaitForChild("Clouds")
local tween1 = tweenService:Create(clouds, tweenInfo, {["Cover"] = 0.0})
local tween2 = tweenService:Create(clouds, tweenInfo, {["Cover"] = 0.6})
local enabled = true
game.Lighting:GetPropertyChangedSignal("ClockTime"):Connect(function()
if game.Lighting.ClockTime > 6 and game.Lighting.ClockTime < 18 then
if enabled == true then return end
enabled = true
tween2:Play()
else
if enabled == false then return end
enabled = false
tween1:Play()
end
end)
another option is to tween the clouds color to make them darker at night
and that will look like this
local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(5, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)
local clouds = workspace:WaitForChild("Terrain"):WaitForChild("Clouds")
local tween1 = tweenService:Create(clouds, tweenInfo, {["Color"] = Color3.new(0.2, 0.2, 0.2)})
local tween2 = tweenService:Create(clouds, tweenInfo, {["Color"] = Color3.new(1, 1, 1)})
local enabled = true
game.Lighting:GetPropertyChangedSignal("ClockTime"):Connect(function()
if game.Lighting.ClockTime > 6 and game.Lighting.ClockTime < 18 then
if enabled == true then return end
enabled = true
tween2:Play()
else
if enabled == false then return end
enabled = false
tween1:Play()
end
end)