How do I change CFrame angles and CFrame position separately?

I am trying to make some sort of viewmodel sway but since it is a viewmodel, I need to use CFrame. I want to try setting the CFrame position immediately and then tweening the CFrame rotation. How could I do that?

This is my current code, but the issue is that since I am changing the Position instead of the CFrame it makes the arms fly away.

local cameraArms = workspace.CurrentCamera:FindFirstChild("Arms")
cameraArms.PrimaryPart.Position = workspace.CurrentCamera.CFrame.Position
TweenService:Create(
	cameraArms.PrimaryPart, 
	TweenInfo.new(0.05, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut), 
	{CFrame = workspace.CurrentCamera.CFrame}
):Play()

Also I am pretty new to cframe stuff so I probably won’t know alot of things about it

CFrame.Angles should do it.

CFrame *= CFrame.Angles(0,0,0)

I got it kinda, it works now! Basically I added a CFrame value called “AnglesTweened” inside the viewmodel that contains the angle of the CFrame (tweened). Then it just sets the cframe of the viewmodel to the normal position times the tweened angles.

local cameraArms = workspace.CurrentCamera:FindFirstChild("Arms")
local cameraPosition = workspace.CurrentCamera.CFrame.Position
cameraArms:SetPrimaryPartCFrame(CFrame.new(cameraPosition.X, cameraPosition.Y, cameraPosition.Z) * cameraArms.AnglesTweened.Value)
TweenService:Create(cameraArms.AnglesTweened, TweenInfo.new(0.05, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut), {Value = workspace.CurrentCamera.CFrame - workspace.CurrentCamera.CFrame.Position}):Play()
1 Like