Make player turn their upper body in camera direction

So I want to make player’s upper body face in the direction where camera is currently looking at (in R15). I can’t figure out how this works.
I’ve tried looking for solutions, but they ended up dragging my character all around the map or do nothing at all.

I managed to make a rough draft of that functionality.
Take in count it behaves a little buggy when the camera is turned up/down. This script is just a primitive base from which you can start working on your idea… I’ll keep working on it and I’ll let you know if I can fix the movement bugs, but it’s a good starting point :+1::

local Players = game:GetService("Players")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()

local function updateCharacterRotation()
	local camera = workspace.CurrentCamera
	if not camera then return end
	local connection = camera:GetPropertyChangedSignal("CFrame"):Connect(function()
		character:SetPrimaryPartCFrame(CFrame.new(character.PrimaryPart.Position, camera.CFrame.p) * CFrame.Angles(0, math.rad(180), 0))
	end)

	camera.AncestryChanged:Connect(function(_, parent)
		if not parent then
			connection:Disconnect()
		end
	end)
end

updateCharacterRotation()

Hope it helps! :four_leaf_clover:

EDIT: The script runs well in a LocalScript in StarterPlayer->StarterCharacterScripts.

A VERY helpful youtuber who makes tutorials on roblox lua has done a video on this:

1 Like