I am trying to make a flickering light, but it is not working. The code is running, it has found the parts, and it can change the material of something, but the light will not change brightness, range, or parent properties.
Output
Hierarchy
Code
lightPart = script.Parent.Parent
print(lightPart.Name)
light = script.Parent
print(light.Name)
bright = light.Brightness
print(bright)
print("Starting light flicker")
while true do
bright = 1
lightPart.Material = Enum.Material.Neon
--wait(math.random(0.1, 0.5))
wait(1)
bright = 0.01
lightPart.Material = Enum.Material.Glass
--wait(math.random(0.1, 0.5))
wait(1)
print("loop")
end
I want the light to turn on and off, and I want the material of the lightPart to change at a random interval so it looks like flickering. I changed it to 1 second for testing.
If you want to see it in game: Hexagon Labs - Roblox