I have this flashlight tool that has bool value named "Broken" in it that is set to false If its true script should turn off flashlight until "Broken" is set to false again but for some reason it doesnt work (Normal script)
local on = false local broken = script.Parent:FindFirstChild("Broken") local function turnoffflashlight() if broken.Value == true then script.Parent.Light.Shadow.Enabled = false script.Parent.Light.Light.Enabled = false script.Parent.Front.SurfaceLight.Enabled = false end end script.Parent.Activated:Connect(function() if on == false then on = true script.Parent.Light.Sound:Play() if broken.Value == true then print("Broken") else script.Parent.Light.Shadow.Enabled = true script.Parent.Light.Light.Enabled = true script.Parent.Front.SurfaceLight.Enabled = true end elseif on == true then on = false script.Parent.Light.Sound2:Play() if broken.Value == true then print("Broken") else script.Parent.Light.Shadow.Enabled = false script.Parent.Light.Light.Enabled = false script.Parent.Front.SurfaceLight.Enabled = false end end end) broken:GetPropertyChangedSignal("Value"):Connect(turnoffflashlight)
even with all these if's flashlight works