Invalid argument #2 (Vector3 expected, got CFrame) [CLOSED]

Hello, i’ve been recently trying to make a local script to make a camera rotate when you access the camera. but everything i tried to make it rotate didn’t work and i remained to this error.
I even tried to look for older topics about this but no luck.

function AttachCamera(securitycam)
	if not mycamera then
		return
	end
	newcamera.CameraType = Enum.CameraType.Scriptable
	newcamera.Focus = securitycam.CFrame --* CFrame.new(Vector3.new(0,0,-0.35001))
	newcamera.CoordinateFrame = securitycam.CFrame --* CFrame.new(0,0,-0.35)
	newcamera.Parent = workspace
	workspace.CurrentCamera = newcamera
	local part = newcamera
	local ori = part.CoordinateFrame
	local tweenService = game:GetService("TweenService")

	local changes = {
		CFrame = ori + CFrame.Angles(0, 90, 0)
	}

	local tweenInfo = TweenInfo.new(
		4,									-- Time taken for a full animation
		Enum.EasingStyle.Quad,			-- Animation Style
		Enum.EasingDirection.InOut,			-- Animation Type
		-1,									-- Number of repeats
		true,								-- Reverse
		1									-- Delay between animation
	)

	local tween = tweenService:Create(part, tweenInfo, changes)
	tween:Play()
	
end

this is my first time trying to code with cameras

You can do CFrame.Position to return Vector3. CFrame is essential for everything relating to position, rotation, etc.

Wait what do you mean by that.
Can you show me an example (if possible) on what should i change?

Yeah i resolved it myself. still thank you for helping

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.