Have I done something wrong? My goal here is when a light is turned off for more than between 30 and 50 seconds, a global variable will be set to true causing multiple other events to fire. I'm not having problems with the global variable, it's more that when I turn off the light, nothing happens. I put the print function in there to see if it's noticing that the light is turned off, but I never get the printed message in the output.
local blackFigureEvent = false
local Rand = Random.new()
while true do
wait(0.1)
if workspace.HouseParts.BedLight1.LightPart.PointLight.Enabled == false then
wait(0.1)
print("Light is off")
wait(Rand:NextNumber(30, 50));
_G.blackFigureEvent = true
print("Event activated")
end
end

1 comment
Thank you!