I have a script to disable the controls to a control board if a control box breaks. However, the box isn't broken, yet the levers and controls don't operate. Code is below. It still plays the sound, but everything about changing it doesn't work.
function onClicked() script.Parent.switch:Play() if game.Workspace.Controlbreak.Broken == false then if game.Workspace.Variables.Reactorvalve.Value == false then Game.Workspace.Variables.Reactorvalve.Value = true elseif game.Workspace.Variables.Reactorvalve.Value == true then Game.Workspace.Variables.Reactorvalve.Value = false end end end script.Parent.ClickDetector.MouseClick:connect(onClicked)
hmm could it be as simple as a missing .Value
from your first if statement?
function onClicked() script.Parent.switch:Play() -- change this from \/\/\/\/ -- if game.Workspace.Controlbreak.Broken == false then << if game.Workspace.Controlbreak.Broken.Value == false then -- << to this ? if game.Workspace.Variables.Reactorvalve.Value == false then Game.Workspace.Variables.Reactorvalve.Value = true elseif game.Workspace.Variables.Reactorvalve.Value == true then Game.Workspace.Variables.Reactorvalve.Value = false end end end script.Parent.ClickDetector.MouseClick:connect(onClicked)