I was trying to make a street light script for my game, but for some reason its just not working at all:
local Lighting = game:GetService("Lighting")
local LightGroup = script.Parent:FindFirstChild("Light")
local Light = LightGroup:FindFirstChild("Light")
local PrimaryLightColor
local IsLightOn = script:FindFirstChild("IsLightOn")
local IsLightOrange = script:FindFirstChild("IsLightOrange")
local SpotLight = Light:WaitForChild("SpotLight")
if IsLightOrange.Value == true then
PrimaryLightColor = Color3.fromRGB(181, 122, 47)
else
PrimaryLightColor = Color3.fromRGB(255, 255, 255)
end
Lighting:GetPropertyChangedSignal("ClockTime"):Connect(function()
if (Lighting.ClockTime > 6.25) and (Lighting.ClockTime < 17.5) then
print("es")
IsLightOn.Value = false
SpotLight.Enabled = false
Light.Material = Enum.Material.Glass
Light.Color = Color3.fromRGB(68, 65, 67)
Light.Transparency = 0.35
elseif (Lighting.ClockTime < 6.25) and (Lighting.ClockTime > 17.5) then
print("e")
IsLightOn.Value = true
SpotLight.Enabled = true
Light.Material = Enum.Material.Neon
Light.Color = PrimaryLightColor
SpotLight.Color = PrimaryLightColor
Light.Transparency = 0
end
end)
I already tried print debugging, it didn’t print anything in either of them.
Thanks in advance! (I believe the problem is in the property change signal)
Alright, I found the issue. I wasn’t using a daylight cycle which set GetMinutesAfterMidnight(). Instead I was changing the time manually which obviously did not work.