Suppose to work until it runs out of time, after that it breaks but u should still be able to turn it on just won work like it used to.
local Switch1 = script.Parent.Switch1 --Transperent if on-- local Switch2 = script.Parent.Switch2--Transperent if off-- local SwitchSound = script.Parent.Frame.Switch local PopSound = script.Parent.Bulb.Pop local Light = script.Parent.Bulb.Light script.Parent.Frame.FlickSwitch.MouseClick:Connect(function() if not script.Parent.IsOn.Value then --If Not on then-- if script.Parent.IsBroken.Value == false then --Check if its broken-- SwitchSound:Play() Switch1.Transparency = 1 Switch2.Transparency = 0 Light.Enabled = true script.Parent.IsOn.Value = true print("Is On") elseif script.Parent.IsBroken.Value == true then SwitchSound:Play() Switch1.Transparency = 1 Switch2.Transparency = 0 script.Parent.IsOn.Value = true print("Is On but is broken") elseif script.Parent.IsBroken.Value == false then --Turn off the light normally-- SwitchSound:Play() Switch1.Transparency = 0 Switch2.Transparency = 1 Light.Enabled = false script.Parent.IsOn.Value = false print("Is Off") else SwitchSound:Play() Switch1.Transparency = 1 Switch2.Transparency = 0 script.Parent.IsOn.Value = true print("Is On but broken") end end end) script.Parent.IsOn.Changed:Connect(function() script.Parent.Hours.Value = script.Parent.Hours.Value - 2 if script.Parent.Hours.Value <= 0 and not script.Parent.IsBroken.Value then Light.Enabled = false PopSound:Play() script.Parent.IsBroken.Value = true end end)