Failing to set Part position with Camera position

So im trying to set the position of a part to the camera’s position. (Not angle, just position.)

arm.arm.CFrame = game.Workspace.Camera.CFrame.Position

When I try that, I get this:

(CFrame expected, got Vector3)

Please know that I barely ever use CFrame, so I barely even know how this works.

I have also tried this:

arm.arm.CFrame = game.Workspace.Camera.CFrame

But that sets the angle too.

Sorry if I needed to make this post longer

CFrame are NOT Vector3 values. A lot of people who are relatively new to OOP get that mixed up, so it’s definitely normal and thank you for asking :slight_smile:

CFrames have their own values. You can apply Vector3 values to CFrame values, but I don’t want to give you the whole API for CFrames. I will provide you with appropriate information if you’d like.

To fix your script, you need to create a CFrame value rather than comparing a CFrame to a Vector3:

arm.arm.CFrame = CFrame.new(game.Workspace.Camera.Position)
2 Likes

That would work for a part, but a camera doesnt have a position property. Would i need to do cframe.Position?

Ahh, my bad!! I should’ve paid closer attention to your code. Yes, you would do CFrame.Position to find the position of the CFrame, but I would use the CurrentCamera rather than the camera in the workspace.

1 Like
workspace.CurrentCamera.CFrame = your part's cframe

Ok, thanks! that worked. I know I told not to use angles in this post but if I tween an angle, it then starts teleporting around everywhere.

Still I know that I didnt say to use angles.

Also, if giving this info helps, i’m trying to make some sort of arm sway by tweening the angle and instantly setting the position. (This is pretty much a first person viewmodel)