✓ Accepted answer
So, for starters, write more "clean" script.
Anyway, as some people pointed out in the comments, the script does not loop. Next is the fact that we have to assume that the script is in the light. If it is not, this explains why (you used script.Parent.Enabled = true). If it is, I would move it into the part the light is parented by.
The script I would try would be something along the lines of...
local Light = script.Parent.Light
local Lighting = game.Lighting
Lighting:GetPropertyChangedSignal("ClockTime"):Connect(function()
local time = Lighting.ClockTime
if time == 6 then
Light.Enabled = false
elseif time == 18 then
Light.Enabled = true
end
end)
Also: Just noticed this, but you don't need quotes with numbers. You only need quotes for anything (starting) with non-number characters (with exceptions for certin things like true) like "world856" and "what in the world" compared with 84FallingTree or 7
2 comments
it only runs once
maybe wrap it in a GetPropertyChangedSignal event