How do i make a script to switch the camera to various postions

ive already done this twice but both attempts didnt work.

Heres the first attempt:

local InWork = true
local Cam = game.Workspace.CurrentCamera
local Player = game.Players.LocalPlayer
local Pos = game.Workspace:WaitForChild("Cams")
local UIS = game:GetService("UserInputService")
local ts = game:GetService("TweenService")
local CurrentCam = Pos:WaitForChild("Ordering 1")

local InfoT = TweenInfo.new(0.5, Enum.EasingStyle.Bounce)

function tweenCamera(part, toPlr)
	if toPlr then
		local tween = ts:Create(Cam, InfoT, {CFrame = Player.Character.PrimaryPart})
		tween:Play()
		tween.Completed:Wait()
		Cam.CameraType = Enum.CameraType.Custom
	else
		Player.Character.PrimaryPart.CFrame = Cam.CFrame
		while Cam.CameraType ~= Enum.CameraType.Scriptable do
			Cam.CameraType = Enum.CameraType.Scriptable
		end
		ts:Create(Cam, InfoT, {CFrame = part.CFrame}):Play()
	end
end

tweenCamera(CurrentCam, false)
print(Pos:GetChildren())

-- For PC --
UIS.InputBegan:Connect(function(Inp, GPE)
	if Inp.KeyCode == Enum.KeyCode.E then
		
		
		
		local IndexCheck = #Pos:GetChildren()
		if table.find(Pos:GetChildren(), CurrentCam) + 1 > IndexCheck then
			print("E")
			local NextIndex = 1
			CurrentCam = Pos:GetChildren()[NextIndex]
			tweenCamera(CurrentCam, false)
			print(NextIndex)
		else
			print("E")
			local NextIndex = table.find(Pos:GetChildren(), CurrentCam) + 1
			CurrentCam = Pos:GetChildren()[NextIndex]
			tweenCamera(CurrentCam, false)
			print(NextIndex)
		end
		
		
		
	elseif Inp.KeyCode == Enum.KeyCode.Q then
		
		
		
		local IndexCheck = 1
		if table.find(Pos:GetChildren(), CurrentCam) - 1 < IndexCheck then
			print("q")
			local NextIndex = #Pos:GetChildren()
			CurrentCam = Pos:GetChildren()[NextIndex]
			tweenCamera(CurrentCam, false)
			print(NextIndex)
		else
			print("q")
			local NextIndex = table.find(Pos:GetChildren(), CurrentCam) - 1
			CurrentCam = Pos:GetChildren()[NextIndex]
			tweenCamera(CurrentCam, false)
			print(NextIndex)
		end
		
	end
	
end)

The issue with this one is sometimes the controlls would be inverted meaning Q went right and E went left when it should be the other way

Heres my second attempt:

local InWork = true
local Cam = game.Workspace.CurrentCamera
local Player = game.Players.LocalPlayer
local Pos = game.Workspace:WaitForChild("Cams")
local UIS = game:GetService("UserInputService")
local ts = game:GetService("TweenService")
local CurrentCam = Pos:WaitForChild("1Ordering 1")

local InfoT = TweenInfo.new(0.5, Enum.EasingStyle.Bounce)

function tweenCamera(part, toPlr)
	if toPlr then
		local tween = ts:Create(Cam, InfoT, {CFrame = Player.Character.PrimaryPart})
		tween:Play()
		tween.Completed:Wait()
		Cam.CameraType = Enum.CameraType.Custom
	else
		Player.Character.PrimaryPart.CFrame = Cam.CFrame
		while Cam.CameraType ~= Enum.CameraType.Scriptable do
			Cam.CameraType = Enum.CameraType.Scriptable
		end
		ts:Create(Cam, InfoT, {CFrame = part.CFrame}):Play()
	end
end

tweenCamera(CurrentCam, false)
print(Pos:GetChildren())

-- For PC --
UIS.InputBegan:Connect(function(Inp, GPE)
	if Inp.KeyCode == Enum.KeyCode.E then
		if table.find(Pos:GetChildren(), CurrentCam)+1 > #Pos:GetChildren() then
			print("Going back to start")
			tweenCamera(Pos:GetChildren()[1], false)
		else
			print("Contining")
			tweenCamera(Pos:GetChildren()[table.find(Pos:GetChildren(), CurrentCam)+1], false)
			CurrentCam = Pos:GetChildren()[table.find(Pos:GetChildren(), CurrentCam)+1]
		end
	elseif Inp.KeyCode == Enum.KeyCode.Q then
		if table.find(Pos:GetChildren(), CurrentCam)-1 < 1 then
			print("Going back to End")
			tweenCamera(Pos:GetChildren()[#Pos:GetChildren()], false)
		else
			print("Contining")
			tweenCamera(Pos:GetChildren()[table.find(Pos:GetChildren(), CurrentCam)-1], false)
			CurrentCam = Pos:GetChildren()[table.find(Pos:GetChildren(), CurrentCam)-1]
		end
	end
end)

The issue with this one is that i could only go to the leftmost or rightmost positions. Also the controlls would randomly invert.

Thanks for any help, i dont know much about tweenign the camera or keeping track of tables.