local oh,om = 6,18 -- Open Time (hours,minutes)
local ch,cm = 18,00 -- Close Time (hours, minutes)
local p = workspace.Terrain
local l = game:service("Lighting")
if (om == nil) then om = 0 end
if (cm == nil) then cm = 0 end
function TimeChanged()
local ot = (oh + (om/60)) * 60
local ct = (ch + (cm/60)) * 60
if (ot < ct) then
if (l:GetMinutesAfterMidnight() >= ot) and (l:GetMinutesAfterMidnight() <= ct) then
p.Clouds.Cover = 0
p.Clouds.Cover = 0.1
p.Clouds.Cover = 0.2
p.Clouds.Cover = 0.3
p.Clouds.Cover = 0.4
p.Clouds.Cover = 0.5
p.Clouds.Cover = 0.6
else
p.Clouds.Cover = 0.6
end
elseif (ot > ct) then
if (l:GetMinutesAfterMidnight() >= ot) or (l:GetMinutesAfterMidnight() <= ct) then
p.Clouds.Cover = 0.6
p.Clouds.Cover = 0.5
p.Clouds.Cover = 0.4
p.Clouds.Cover = 0.3
p.Clouds.Cover = 0.2
p.Clouds.Cover = 0.1
p.Clouds.Cover = 0
else
p.Clouds.Cover = 0
end
end
end
TimeChanged()
game.Lighting.Changed:connect(function(property)
if (property == "TimeOfDay") then
TimeChanged()
end
end)
I added the TweenService into the script and it didn’t help. Maybe I added it wrong or something like that?
local oh,om = 6,18 -- Open Time (hours,minutes)
local ch,cm = 18,00 -- Close Time (hours, minutes)
local p = workspace.Terrain
local TweenService = game:GetService('TweenService')
local l = game:service("Lighting")
if (om == nil) then om = 0 end
if (cm == nil) then cm = 0 end
function TimeChanged()
local ot = (oh + (om/60)) * 60
local ct = (ch + (cm/60)) * 60
if (ot < ct) then
if (l:GetMinutesAfterMidnight() >= ot) and (l:GetMinutesAfterMidnight() <= ct) then
TweenService:Create(
p.Clouds, -- UI object you're tweening
TweenInfo.new(10), -- Amount of seconds
{Cover = 0.6} -- Goal
):Play()
else
p.Clouds.Cover = 0.6
end
elseif (ot > ct) then
if (l:GetMinutesAfterMidnight() >= ot) or (l:GetMinutesAfterMidnight() <= ct) then
TweenService:Create(
p.Clouds, -- UI object you're tweening
TweenInfo.new(10), -- Amount of seconds
{Cover = 0} -- Goal
):Play()
else
p.Clouds.Cover = 0
end
end
end
TimeChanged()
game.Lighting.Changed:connect(function(property)
if (property == "TimeOfDay") then
TimeChanged()
end
end)
i see, try structuring your TweenService block like this:
local TweenService = game:GetService("TweenService")
local goal = {
Transparency == 0 -- what you want at the end
}
local TweenInfo = TweenInfo.new(
5, -- time
Enum.EasingStyle.Linear, --the style
Enum.EasingDirection.Out, -- the easing direction
1,-- repeat
false, -- reverse
1 -- delay
)
local tween = TweenService:Create(YOUR OBJECT, TweenInfo, goal) --your object aka clouds
tween:Play()
Error: ServerScriptService.Script:12: Expected ‘)’ (to close ‘(’ at line 11), got ','
local oh,om = 6,18 -- Open Time (hours,minutes)
local ch,cm = 18,00 -- Close Time (hours, minutes)
local p = workspace.Terrain
local TweenService = game:GetService('TweenService')
local goal1 = {
Cover == 0.6 -- what you want at the end
}
local goal2 = {
Cover == 0 -- what you want at the end
}
local TweenInfo = (
5, -- time
Enum.EasingStyle.Linear, --the style
Enum.EasingDirection.Out, -- the easing direction
1,-- repeat
false, -- reverse
1 -- delay
)
local tween1 = TweenService:Create(workspace.Terrain.Clouds, TweenInfo, goal1) --your object aka clouds
local tween2 = TweenService:Create(workspace.Terrain.Clouds, TweenInfo, goal2) --your object aka clouds
local l = game:service("Lighting")
if (om == nil) then om = 0 end
if (cm == nil) then cm = 0 end
function TimeChanged()
local ot = (oh + (om/60)) * 60
local ct = (ch + (cm/60)) * 60
if (ot < ct) then
if (l:GetMinutesAfterMidnight() >= ot) and (l:GetMinutesAfterMidnight() <= ct) then
tween1:Play()
else
p.Clouds.Cover = 0.6
end
elseif (ot > ct) then
if (l:GetMinutesAfterMidnight() >= ot) or (l:GetMinutesAfterMidnight() <= ct) then
tween2:Play()
else
p.Clouds.Cover = 0
end
end
end
TimeChanged()
game.Lighting.Changed:connect(function(property)
if (property == "TimeOfDay") then
TimeChanged()
end
end)
I’m not a scripter so if there is something wrong with this then you know