Can't add CFrames

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to add two CFrames

  2. What is the issue? Include screenshots / videos if possible!
    It’s saying I’m trying to add a Vector3 and CFrame, but I printed both CFrames

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I can’t find anyone with this same issue.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable

local character = game.Players.LocalPlayer.Character

while true do
	local rotX, rotY, rotZ = camera.CFrame:ToEulerAnglesXYZ()
	local previousCameraRotation = Vector3.new(rotX, rotY, rotZ)
	local rotation = (character.Head.Orientation-previousCameraRotation).Magnitude
	if (character.Head.Orientation-previousCameraRotation).X < 0 then
		rotation *= 1
	end
	local cameraCFrame_pos = CFrame.new(character.Head.Position)
	local cameraCFrame_rot = CFrame.fromOrientation(0, rotation, 0)
	print(cameraCFrame_pos)
	print(cameraCFrame_rot)
	local cameraCFrame = cameraCFrame_pos + cameraCFrame_rot
	print(cameraCFrame)
	camera.CFrame = cameraCFrame
	task.wait()
end

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

You can’t add cframes, instead you have to multiply them to get the same effect.

You cannot add CFrame to a CFrame, what you can do is add a Vector3 to a CFrame.

That’s what it thinks I’m doing, but it’s not working.
I changed my code to do that, but it’s still not working
image

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