I’ve been trying to make a fence light, however, the ClockTime doesn’t work. Here’s a preview of the code:
I followed the Roblox tutorial “Street Light”, it didn’t work from my previous change of this code and I tried to do this in my code.
PROPERTIES:
- LightSwitch: A BoolValue Instance
--// Nothing is saying "Turn Off" and "Turn On" at specific time
while wait(1) do
local ClockTime = game:GetService("Lighting").ClockTime
local LightSwitch = script.Parent.Lights
if ClockTime >= 17 and ClockTime <= 5 and LightSwitch.Value == false then
warn("Turned on fence lights")
LightSwitch.Value = true
end
if ClockTime < 17 and ClockTime > 5 and LightSwitch.Value == true then
warn("Turned off fence lights")
LightSwitch.Value = false
end
end
What should I change or improve?