It is a very simples script, I don't know if I am missing some rules..
local dark = game.Workspace.Dark.Value local light = script.Parent:FindFirstChild("Sector 1 Light") if dark == true then light.BrickColor = BrickColor.new("Really black") end
the game.Workspace.Dark is a bool value that I have in the workspace. I made a script inside it telling it to immediately go to true, but the script right here that you are seeing is in a light. This light is not changing brickcolors.
Hello.
The problem with your script is that the if statement would only run once and end the script.
To fix this, you must connect the dark value to a Changed
event. It will fire whenever its value is changed.
Also, I removed the .Value
in the dark
variable as the variable stores a boolean from the start of the game.
Anyways, here's your fixed script:
local dark = game.Workspace.Dark local light = script.Parent:FindFirstChild("Sector 1 Light") dark.Changed:Connect(function() if dark.Value == true then light.BrickColor = BrickColor.new("Really black") end end)
I hope this helps, cheers!