Hello. I was trying to make a working streetlight. Upon scripting, I failed (like always lol)
Script:
local lighting = game.Lighting
local lightpart = script.Parent.light
lightpart.SpotLight.Enabled = false
if lighting.ClockTime == 17.2-7 then
lightpart.SpotLight.Enabled = true
elseif lighting.ClockTime == 7-17.2 then
lightpart.SpotLight.Enabled = false
end
btw streetlight activates during night and is inactive during day
local lighting = game:GetService("Lighting")
local lightpart = script.Parent.light
lighting:GetPropertyChangedSignal('ClockTime'):Connect(function()
lightpart.SpotLight.Enabled = false
if lighting.ClockTime >= 17.2 or lighting.ClockTime < 7 then
lightpart.SpotLight.Enabled = true
else
lightpart.SpotLight.Enabled = false
end
end)
It works in run test but doesn’t work in play test???
EDIT: ok nvm it doesnt work when i change the lighting settings manually in playtest, gotta do it with admin cmds