Trying to make the torso follow the direction of my camera?

What I’m going for is a camera that just moved the torso up or down depending on the camera angle. I have the camera set to “Shift-Lock” So I’m really only going for vertical movements.


The only reason I’m looking into this is because whenever I want to add different weapons like bows or something, I really want the player to able to shoot up or down as well. Same for sword swings.

I have this placed in the UpperTorso part of my custom rig.

local torso = script.Parent  -- Reference to the torso
local camera = game.Workspace.Camera  -- Reference to the camera

while true do
	-- Get the position of the camera
	local cameraPosition = camera.CFrame.Position

	-- Calculate the direction from the torso to the camera
	local lookDirection = (cameraPosition - torso.Position).unit

	-- Calculate the rotation needed to point the torso towards the camera
	local lookAtRotation = CFrame.new(torso.Position, torso.Position + lookDirection)

	-- Apply the rotation to the torso
	torso.CFrame = lookAtRotation

	-- Wait for a short time before updating again
	wait(0.1)
end

I’m relatively new to scripting, but this was the best I could come up with in terms of this. Sadly, not many free scripts work with my custom rig. Below are the parts within the character rig.