--[[
function moveupL1()
	local amount = A
	local current = 0
	MoverL1.TargetPosition = 0.076
	repeat
		current = current + amount/B
		script.Parent.LowToneSolenoid.MovingParts.Spring.Size = script.Parent.LowToneSolenoid.MovingParts.Spring.Size + Vector3.new(0,0,(amount/B)*C)
		local lv = script.Parent.LowToneSolenoid.MovingParts.Spring.CFrame.LookVector
		script.Parent.LowToneSolenoid.MovingParts:TranslateBy(lv*-amount/B)
		game:GetService("RunService").Heartbeat:wait()
	until current >= A
end

function movebackL1()
	local amount = A
	local current = 0
	MoverL1.TargetPosition = 0
	repeat
		current = current + amount/B
		script.Parent.LowToneSolenoid.MovingParts.Spring.Size = script.Parent.LowToneSolenoid.MovingParts.Spring.Size + Vector3.new(0,0,-(amount/B)*C)
		local lv = script.Parent.LowToneSolenoid.MovingParts.Spring.CFrame.LookVector
		script.Parent.LowToneSolenoid.MovingParts:TranslateBy(lv*amount/B)
		game:GetService("RunService").Heartbeat:wait()
	until current >= A
end

function moveupL2()
	local amount = A
	local current = 0
	MoverL2.TargetPosition = 0.076
	repeat
		current = current + amount/B
		script.Parent.HighToneSolenoid.MovingParts.Spring.Size = script.Parent.HighToneSolenoid.MovingParts.Spring.Size + Vector3.new(0,0,(amount/B)*C)
		local lv = script.Parent.HighToneSolenoid.MovingParts.Spring.CFrame.LookVector
		script.Parent.HighToneSolenoid.MovingParts:TranslateBy(lv*-amount/B)
		game:GetService("RunService").Heartbeat:wait()
	until current >= A
end

function movebackL2()
	local amount = A
	local current = 0
	MoverL2.TargetPosition = 0
	repeat
		current = current + amount/B
		script.Parent.HighToneSolenoid.MovingParts.Spring.Size = script.Parent.HighToneSolenoid.MovingParts.Spring.Size + Vector3.new(0,0,-(amount/B)*C)
		local lv = script.Parent.HighToneSolenoid.MovingParts.Spring.CFrame.LookVector
		script.Parent.HighToneSolenoid.MovingParts:TranslateBy(lv*amount/B)
		game:GetService("RunService").Heartbeat:wait()
	until current >= A
end
]]



script.Parent.L1:GetPropertyChangedSignal("Value"):Connect(function()
	if script.Parent.L1.Value == true then
		--moveupL1()
		script.Parent.LowToneSolenoid.ShutterPartClosed.Shutter.Transparency = 0
		script.Parent.LowToneSolenoid.ShutterPartClosed.SolenoidPart.Transparency = 0
		script.Parent.LowToneSolenoid.ShutterPartClosed.Spring.Transparency = 0
		script.Parent.LowToneSolenoid.ShutterPartOpened.Shutter.Transparency = 1
		script.Parent.LowToneSolenoid.ShutterPartOpened.SolenoidPart.Transparency = 1
		script.Parent.LowToneSolenoid.ShutterPartOpened.Spring.Transparency = 1
		SolenoidSound2.Volume = 0.07
		SolenoidSound2:Play()
	else
		--movebackL1()
		script.Parent.LowToneSolenoid.ShutterPartClosed.Shutter.Transparency = 1
		script.Parent.LowToneSolenoid.ShutterPartClosed.SolenoidPart.Transparency = 1
		script.Parent.LowToneSolenoid.ShutterPartClosed.Spring.Transparency = 1
		script.Parent.LowToneSolenoid.ShutterPartOpened.Shutter.Transparency = 0
		script.Parent.LowToneSolenoid.ShutterPartOpened.SolenoidPart.Transparency = 0
		script.Parent.LowToneSolenoid.ShutterPartOpened.Spring.Transparency = 0
		SolenoidSound2.Volume = 0.03
		SolenoidSound2:Play()
	end
end)

function ActivateSolenoids()
	if Flasher.On.Value == true and Flasher.Power.Value == true then
		if Flasher.Outputs.SIG1.Value == true then
			script.Parent.L1.Value = true
			script.Parent.L2.Value = false
		else
			script.Parent.L1.Value = false
			script.Parent.L2.Value = true
		end
	else
		script.Parent.L1.Value = false
		script.Parent.L2.Value = false
	end
end

Flasher.Outputs.SIG1.Changed:Connect(function()
	ActivateSolenoids()
end)

Flasher.On.Changed:Connect(function()
	script.Parent.ModulationActive.Value = Flasher.On.Value
	ActivateSolenoids()
end)

Flasher.Outputs.SIG1.Test.Changed:Connect(function()
	repeat wait()
		script.Parent.L1.Value = true
	until Flasher.Power.Value == false or Flasher.Outputs.SIG1.Test.Value == false
	script.Parent.L1.Value = false
end)

Flasher.Outputs.SIG2.Test.Changed:Connect(function()
	repeat wait()
		script.Parent.L2.Value = true
	until Flasher.Power.Value == false or Flasher.Outputs.SIG2.Test.Value == false
	script.Parent.L2.Value = false
end)