The script is as follows:
local terrain = game.Workspace.Terrain
local Time = game.Lighting.TimeOfDay
local daynight = script.Parent.DayNight.Value
print(“gotpastcode3”)
local colorValue = Instance.new(“Color3Value”)
colorValue.Value = terrain:GetMaterialColor(“Grass”)
colorValue.Parent = script.Parent
print(“gotpastcode2”)
colorValue:GetPropertyChangedSignal(“Value”):connect(function()
terrain:SetMaterialColor(“Grass”, colorValue.Value)
end)
print(“gotpastcode1”)
local tweenInfo = TweenInfo.new(60, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
local Night = game:GetService(“TweenService”):Create(colorValue, tweenInfo, {Value = Color3.fromRGB(91, 122, 380 )})
local Day = game:GetService(“TweenService”):Create(colorValue, tweenInfo, {Value = Color3.fromRGB(110, 148, 70)})
print(“got past code”)
while true do
TimeOfDay = game.Lighting:GetMinutesAfterMidnight()
print(“Looped”)
if TimeOfDay >= ‘21:00:00’ and daynight == 0 then
Night:Play()
print(“Tweened”)
daynight = 1
end
if TimeOfDay >= ‘6:00:00’ and daynight == 1 and TimeOfDay <= ‘7:00:00’ then
Day:Play()
print(“Went back”)
daynight = 0
end
wait(0.1)
end