So,I wanted to make a blackout event that occurs every like hour or so,but for some reason it doesnt detect when the value changes and the lights do not go off, i have no idea how to describe it more but heres the code in the lights
local pointlight = script.Parent.PointLight
local LightPart = script.Parent
LightPart.Material = "Neon"
LightPart.BrickColor = BrickColor.new("Institutional white")
local BlackoutValue = workspace.BlackoutTIme
BlackoutValue.Changed:Connect(function()
if BlackoutValue == "yes" then -- String value
LightPart.Material = "Plastic"
LightPart.BrickColor = BrickColor.new("Really black")
pointlight.Brightness = 0
pointlight.Range = 0
elseif BlackoutValue == "no" then
LightPart.Material = "Neon"
LightPart.BrickColor = BrickColor.new("Institutional white")
pointlight.Brightness = 1
pointlight.Range = 60
end
end)
and the code in the ServerScriptService
local function BlackoutLoop()
local BlackoutTime = math.random(2,5) -- 300,600
local TimeToBlackout = math.random (2,5) -- 900,3000
local blackoutValue = workspace.BlackoutTIme -- should be no or yes
blackoutValue = "no"
print("Blackout Ended!")
wait(TimeToBlackout)
blackoutValue = "yes"
print("Blackout Started!")
wait(BlackoutTime)
BlackoutLoop()
end
BlackoutLoop()
Would really appreciate any suggestions or stuff like that Thank you

4 comments
Thank you very much! It works now
Im really new to this website,do i need to somehow accept the answer or something like that?
There should be an option next to my comment, I believe it says "Accept answer," or something along those lines. I'm not too sure, though.
Also, you probably didn't see any errors because lines 5 and 8 in the second script were actually setting the locals, so printing the local would print "yes" or "no" (You also can't print an instance, it will give an error. It has to be some property of the instance).