swivler = script.Parent

function rotateMod(mod, center, rotation)
	local parts = {}
	local function scan(parent)
		for _, obj in pairs(parent:GetChildren()) do
			if (obj:IsA("BasePart")) then
				table.insert(parts, obj)
			end
			scan(obj)
		end
	end

	scan(mod)
	for _, part in pairs(parts) do
		part.CFrame = (center * rotation * (center:inverse() * part.CFrame))
	end
end

function Right()

	script.Parent.Left.Use.MaxActivationDistance = 0
	script.Parent.Right.Use.MaxActivationDistance = 0

	if script.Parent.Swivelspot.Value == 1 then
		if script.Parent.Parent.ScreenB.Swivelspot.Value == 6 then
		else
			script.Parent.Base.Move:Play()
			script.Parent.Swivelspot.Value = 6
			local mod = swivler
			local step = 1
			for i = 0, 13.5, step do
				rotateMod(mod, mod:GetModelCFrame(), CFrame.Angles(0, 0.075, 0))
				wait()
			end
		end

	else if script.Parent.Swivelspot.Value == 6 then
		if script.Parent.Parent.ScreenB.Swivelspot.Value == 5 then
		else
			script.Parent.Base.Move:Play()
			script.Parent.Swivelspot.Value = 5
			local mod = swivler
			local step = 1
			for i = 0, 13.5, step do
				rotateMod(mod, mod:GetModelCFrame(), CFrame.Angles(0, 0.075, 0))
				wait()
			end
		end

	else if script.Parent.Swivelspot.Value == 5 then
		if script.Parent.Parent.ScreenB.Swivelspot.Value == 4 then
		else
			script.Parent.Base.Move:Play()
			script.Parent.Swivelspot.Value = 4
			local mod = swivler
			local step = 1
			for i = 0, 13.5, step do
				rotateMod(mod, mod:GetModelCFrame(), CFrame.Angles(0, 0.075, 0))
				wait()
			end
		end

	else if script.Parent.Swivelspot.Value == 4 then
		if script.Parent.Parent.ScreenB.Swivelspot.Value == 3 then
		else
			script.Parent.Base.Move:Play()
			script.Parent.Swivelspot.Value = 3
			local mod = swivler
			local step = 1
			for i = 0, 13.5, step do
				rotateMod(mod, mod:GetModelCFrame(), CFrame.Angles(0, 0.075, 0))
				wait()
			end
		end

	else if script.Parent.Swivelspot.Value == 3 then
		if script.Parent.Parent.ScreenB.Swivelspot.Value == 2 then
		else
			script.Parent.Base.Move:Play()
			script.Parent.Swivelspot.Value = 2
			local mod = swivler
			local step = 1
			for i = 0, 13.5, step do
				rotateMod(mod, mod:GetModelCFrame(), CFrame.Angles(0, 0.075, 0))
				wait()
			end
		end

	else if script.Parent.Swivelspot.Value == 2 then
		if script.Parent.Parent.ScreenB.Swivelspot.Value == 1 then
		else
			script.Parent.Base.Move:Play()
			script.Parent.Swivelspot.Value = 1
			local mod = swivler
			local step = 1
			for i = 0, 13.5, step do
				rotateMod(mod, mod:GetModelCFrame(), CFrame.Angles(0, 0.075, 0))
				wait()
			end
		end
	end
	end
	end
	end
	end
	end
	script.Parent.Left.Use.MaxActivationDistance = 10
	script.Parent.Right.Use.MaxActivationDistance = 10
end

script.Parent.Right.Use.MouseClick:connect(Right)