Invalid argument #1 to 'new' (Vector3 expected, got CFrame)

I’m trying to make a menu camera, but it will not work and only “ok” prints. I also get this error:
ServerScriptService.Script:6: invalid argument #1 to 'new' (Vector3 expected, got CFrame)
Here is the full script

local CurrentCamera = game.Workspace.CurrentCamera
local CameraPart = game.Workspace.Scene1Menu.CameraPart

	CurrentCamera.CFrame = -- Where the error is
1 Like

Get rid of the It is already a cframe.

1 Like

In that script you are creating a new cframe and setting its position to the CFrame. A CFrame is not a vector 3.
You should do “CameraPart.Position” instead of “CameraPart.CFrame”.

Hope this helps! :slight_smile:

1 Like

Position is not a valid member of Camera "Workspace.Camera"

You are not supposed to grab the camera, you are using the CameraPart to get its position in that script, meaning you should continute to use it.

CurrentCamera.CFrame =

This should be the corrected version assuming everything else works just fine.

1 Like

I already did that. Here:
CurrentCamera.Position =

You should only replace the CFrame of the CameraPart with “Position”. Just like I showed in the earlier reply.

CurrentCamera.CFrame =

The CurrentCamera does not have a “personal” position property, it only has a CFrame one that contains a position. To set the position and -or angle of the Camera, you should use CFrames which is the acceptable property of the CurrentCamera.
To create a new CFrame, the first parameter is always going to be a Vector3 value aka a position.

In-case you want the camera to replicate the position and angles of the part, you should do this instead:

CurrentCamera.CFrame = CameraPart.CFrame

This should work, hope it helps! :slight_smile:

1 Like

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