Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I add CFrames to CFrames?

I want to do a recoil system, and I already tried this code:

cam.CFrame = cam.CFrame + CFrame.new(0,0,1)

But it gave me the error: invalid argument #2 (Vector3 expected, got CFrame), so I tried this line:

cam.CFrame = cam.CFrame + Vector.new(0,0,1)

And it stopped giving me the error, but the camera didn't move.

1 answer

✓ Accepted answer

I'm assuming you want to rotate it? You would have to use CFrame.Angles.

Cam.CFrame = Cam.CFrame * CFrame.Angles(math.rad(1), 0, 0)

If you want to just move the camera to a different position using CFrames you could do,

Cam.CFrame = Cam.CFrame * CFrame.new(0, 1, 0)

1 comment

0

The first one was what I was looking for, and it worked, but I tested the second one and it didn't work. Anyways, thank you.

This discussion is preserved as it was. New answers, comments, and votes are closed.