Character's head look in direction

I’m trying to make it so that the Character’s head will face is the same direction as the camera but it isn’t working.

Here is what I tried:

local camera = workspace.Camera

while true do
	player.Character.Head.CFrame = camera.CFrame.LookVector
	wait(0.5)
end

When I did that, it said “Unable to assign property CFrame. CoordinateFrame expected, got Vector3”

Help much appreciated!

3 Likes

LookVector returns a Vector3 instead of a cframe value

use CFrame.new() to convert it into a cframe value

you could maybe try using CFrame.lookAt() to position the head

1 Like

ok so I changed it to

local camera = workspace.Camera

while true do
	player.Character.Head.CFrame = CFrame.lookAt(camera.CFrame.LookVector,Vector3.new(0,0,1),Vector3.new(0,1,0) ) 
	wait(0.5)
end

but now it’s really glitchy and teleports me to the same spot every 0.5 second.

I tweaked it a little with help from the AI assistant and got this:

local camera = workspace.CurrentCamera

while true do
	player.Character.Head.CFrame = CFrame.lookAt(player.Character.Head.Position,-camera.CFrame.Position ) 
	wait(0.01)
end

It doesn’t really work and kind of faces random directions. Also, it affects the entire body, not just the head.

bump

wfikohuiweyeuujhyiyuurefjyuiueiryh

i think you’re looking for this: https://www.youtube.com/watch?v=mdXRnNb0S6o

1 Like

there a server sided version of this script, to where other players can see the characters head movement?

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