hi, I am making a light bar, but I have a problem.
the issue is that when I change activated (boolean value)'s value to true, the lights don't flash!
I can tell by that I don't get "cool" on line 8 in output.
the script is in 1x2 light text (or block).
the activated bool value is in 1x2 light text (or block).
there is no error!
.changed that does not work is on line 60!
script:
---shortcuts
local block = script.Parent
local light = block.PointLight
local activate = block.activated
---function switch
function switch()
print("cool")
---if activated is true
if activate.Value == true then
---change transparency
block.Transparency = 0
---activate light
light.Enabled = true
---change material
block.Material = Enum.Material.Neon
---loop
while activate.Value == true do
---change color of block and light
block.BrickColor = BrickColor.Red()
light.Color = Color3.fromRGB(255, 0, 0)
---wait
wait(math.random(1, 20) / 10)
---change color of block and light
block.BrickColor = BrickColor.Blue()
light.Color = Color3.fromRGB(0, 0, 255)
---wait
wait(math.random(1, 20) / 10)
end
end
---if activated is false
if activate.Value == false then
---change transparency
block.Transparency = 0.5
---change material
block.Material = Enum.Material.Glass
---de-activate light
light.Enabled = false
---change color of block and light
block.BrickColor = BrickColor.White()
light.Color = Color3.fromRGB(255, 255, 255)
end
end
---triggers
activate.Changed:Connect(switch)

6 comments
Is there any script that changes the value of the Activated?/
I don't know maybe instead of making two if statements, use an else if?? Also maybe use :GetPropertyChangedSignal("Value") instead of .Changed?
Try putting any script that changes the value of the Activated.
What type of script is this? Where is it located?
@xInfinityBear it's located inside a workspace part, and I think I know what's going on.
If it's a local script then that's the issue, they don't run in the workspace.