I have this so far, I know I'm missing the checking part but I don't know how to do it, I'm new to scripting.
function timeFix() if game.Lighting.TimeOfDay >= "00:00:00" and game.Lighting.TimeOfDay <= "06:00:00" or game.Lighting.TimeOfDay >= "18:00:00" then script.Parent.Enabled = true else script.Parent.Enabled = false end end
The parent is a spotlight, the rest is pretty self explanatory.
You're attempting to compare two strings as if they were numbers. Rather than using TimeOfDay, use the GetMinutesAfterMidnight()
method instead.
function timeFix() minutes = game.Lighting:GetMinutesAfterMidnight() if minutes >= 0 and minutes <= 360 or minutes >= 1080 then script.Parent.Enabled = true else script.Parent.Enabled = false end end while wait(1) do timeFix() end --This will cause the timeFix() function to run once every second.