Your code is only checking once, and that is right when the game starts. It doesn’t check again.
You will want to check each time the clock time changes using :GetPropertyChangedSignal.
local Lighting = game:GetService("Lighting") -- get services via :GetService()
Lighting:GetPropertyChangedSignal("ClockTime"):Connect(function()
if Lighting.ClockTime >= 21 or Lighting.ClockTime < 6 then
Lighting.FogEnd = 15
else
Lighting.FogEnd = 10000
end
end)