while true do if game.Lighting.Brightness >= 0.9 or game.Lighting.Brightness <= 0 then script.Parent.SpotLight.Enabled = true else script.Parent.SpotLight.Enabled = false end wait() end
while true do local minutes = game.Lighting:GetMinutesAfterMidnight() if minutes >= 1020 or minutes <= 480 then script.Parent.SpotLight.Enabled = true else script.Parent.SpotLight.Enabled = false end wait() end
So these lights turn on when brightness is 0 "a storm is going by" or the time is at night. The problem these being two scripts, during day with brightness 0 the lights flicker because the scripts are fighting each other. How could these scripts be combined so if one is true then the lights will turn on even if the other is false?
I'm not entirely sure what you're trying to do so sorry if this is of no help but.. I think..?
local spotlight = script.Parent.SpotLight local lighting = game.Lighting while wait() do local minutes = game.Lighting:GetMinutesAfterMidnight() if lighting.Brightness >= 0.9 or lighting.Brightness <= 0 or minutes >= 1020 or minutes <= 480 then script.Parent.SpotLight.Enabled = true else script.Parent.SpotLight.Enabled = false end end
while true do local minutes = game.Lighting:GetMinutesAfterMidnight() if minutes >= 1020 or minutes <= 480 or game.Lighting.Brightness <= 0.5 then script.Parent.SpotLight.Enabled = true else script.Parent.SpotLight.Enabled = false end wait() end
that's how it was supposed to be set up