I cant get it to stop when I click the turn off. But when I click off it makes the value false.
Button = script.Parent
Light = game.Workspace.Alarmlight.Light1
Light2 = game.Workspace.Alarmlight.Light2
Button.MouseButton1Down:connect(function()
while true do
if game.Workspace.Alarmlight.Value.Value == true then
game.Workspace.Alarmlight.Light1.SpotLight.Enabled = true
game.Workspace.Alarmlight.Light2.SpotLight.Enabled = true
script.Parent.Parent.AlarmOn.Visible = false
script.Parent.Parent.AlarmOff.Visible = true
Light.CFrame = Light.CFrame * CFrame.fromEulerAnglesXYZ(0.15, 0, 0)
Light2.CFrame = Light2.CFrame * CFrame.fromEulerAnglesXYZ(0.15, 0, 0)
wait(.001)
if game.Workspace.Alarmlight.Value.Value == false then
game.Workspace.Alarmlight.Light1.SpotLight.Enabled = false
game.Workspace.Alarmlight.Light2.SpotLight.Enabled = false
script.Parent.Parent.AlarmOn.Visible = true
script.Parent.Parent.AlarmOff.Visible = false
Light.CFrame = Light.CFrame * CFrame.fromEulerAnglesXYZ(0, 0, 0)
Light2.CFrame = Light2.CFrame * CFrame.fromEulerAnglesXYZ(0, 0, 0)
wait(.001)
end
end
end
end)
