I’m making a day/night cycle system and stumbled upon a rather annoying problem,
here is the problem basically:
as you can see the light flickers weirdly and I’m not sure why.
Here is the script:
local TweenService = game:GetService("TweenService")
local Tick = 1 -- the time it needs to pass 1 hour in game
local Info = TweenInfo.new(Tick,Enum.EasingStyle.Linear)
local Time = game.Lighting
game.Lighting:GetPropertyChangedSignal("ClockTime"):Connect(function(change)
local Time = game.Lighting.ClockTime
if Time == 18 then
end
if Time == 6 then
end
end)
while true do
local tween = TweenService:Create(Time,Info,{ClockTime = Time.ClockTime + 1})
tween:Play()
tween.Completed:Wait()
end
That script is not the cause, probably theres another script that is changing any other Lighting property?
Test that script alone in a different place, theres no flickering
Maybe a bug in studio? It has the same issue on a roblox server?
Try a different approach for the system. Remove the while loop creating and playing a tween, and use RunService renderstep to update the lighting clock. Could help to debug