--RotatorSwitch



function KeepRotatorActive()
	repeat wait()
		RotatorVal.Value = true
	until RotatorSwch.Value == 1 or Power.Value == false
	RotatorVal.Value = false
end

RotatorSwch.Changed:Connect(function()
	if RotatorSwch.Value == 1 then
		RotatorSwch.Parent.P1.Transparency = 0
		RotatorSwch.Parent.P2.Transparency = 1
		RotatorSwch.Parent.P3.Transparency = 1
		RotatorVal.Off.Value = false
		RotatorVal.Value = false
		ClickSound:Play()
	elseif RotatorSwch.Value == 2 then
		RotatorSwch.Parent.P1.Transparency = 1
		RotatorSwch.Parent.P2.Transparency = 0
		RotatorSwch.Parent.P3.Transparency = 1
		ClickSound:Play()
		RotatorVal.Off.Value = true
	else
		ClickSound:Play()
		RotatorSwch.Parent.P1.Transparency = 1
		RotatorSwch.Parent.P2.Transparency = 1
		RotatorSwch.Parent.P3.Transparency = 0
		RotatorVal.Off.Value = false
		if Power.Value == true then
			KeepRotatorActive()
		end
	end
end)

BlowerSwch.Parent.SelectionObjectBrick.ProximityPrompt.Triggered:Connect(function()
	if BlowerSwch.Value == true then
		BlowerSwch.Parent.SelectionObjectBrick.ProximityPrompt.ActionText="Auto"
		BlowerSwch.Value = false
	else
		BlowerSwch.Parent.SelectionObjectBrick.ProximityPrompt.ActionText="Test"
		BlowerSwch.Value = true
	end
end)

ChopperSwch.Parent.SelectionObjectBrick.ProximityPrompt.Triggered:Connect(function()
	if ChopperSwch.Value == true then
		ChopperSwch.Parent.SelectionObjectBrick.ProximityPrompt.ActionText="Auto"
		ChopperSwch.Value = false
	else
		ChopperSwch.Parent.SelectionObjectBrick.ProximityPrompt.ActionText="Test"
		ChopperSwch.Value = true
	end
end)

ControlSwch.Parent.SelectionObjectBrick.ProximityPrompt.Triggered:Connect(function()
	if ControlSwch.Value == true then
		ControlSwch.Parent.SelectionObjectBrick.ProximityPrompt.ActionText="Auto"
		ControlSwch.Value = false
	else
		ControlSwch.Parent.SelectionObjectBrick.ProximityPrompt.ActionText="Test"
		ControlSwch.Value = true
	end
end)

RotatorSwch.Parent.SelectionObjectBrick.ProximityPrompt.Triggered:Connect(function()
	RotatorSwch.Value = RotatorSwch.Value + 1
	if RotatorSwch.Value == 1 then
		RotatorSwch.Parent.SelectionObjectBrick.ProximityPrompt.ActionText="Auto"
	elseif RotatorSwch.Value == 2 then
		RotatorSwch.Parent.SelectionObjectBrick.ProximityPrompt.ActionText="Off"
	elseif RotatorSwch.Value == 3 then
		RotatorSwch.Parent.SelectionObjectBrick.ProximityPrompt.ActionText="Test"
	else
		RotatorSwch.Value = 1
		RotatorSwch.Parent.SelectionObjectBrick.ProximityPrompt.ActionText="Auto"
	end
end)

function Lock()
		if script.Parent.Locked.Value == true then
			BlowerSwch.Parent.SelectionObjectBrick.ProximityPrompt.Enabled = false
			ChopperSwch.Parent.SelectionObjectBrick.ProximityPrompt.Enabled = false
			ControlSwch.Parent.SelectionObjectBrick.ProximityPrompt.Enabled = false
			RotatorSwch.Parent.SelectionObjectBrick.ProximityPrompt.Enabled = false
		else
			BlowerSwch.Parent.SelectionObjectBrick.ProximityPrompt.Enabled = true
			ChopperSwch.Parent.SelectionObjectBrick.ProximityPrompt.Enabled = true
			ControlSwch.Parent.SelectionObjectBrick.ProximityPrompt.Enabled = true
			RotatorSwch.Parent.SelectionObjectBrick.ProximityPrompt.Enabled = true
		end
end

Lock()

script.Parent.Locked.Changed:Connect(function()
	Lock()
end)