Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I create a Head Turn script?

Hello SH, recently I've been trying to create a script where your head would turn to where ever your camera's position was since all the free modeled scripts are now broken because of ROBLOX's animations update. I would like some help on how to create this script. Here's the old broken code if you need it:

repeat wait() until game.Players.LocalPlayer.Character 

game.Players.LocalPlayer.Character.Torso.Neck.MaxVelocity = 0.3

function turnheads()
	while true do
		wait()
		if game.Players.LocalPlayer.Character then
			if game.Workspace.CurrentCamera.CameraSubject == game.Players.LocalPlayer.Character:FindFirstChild("Humanoid") then
				camf = Vector3.new(game.Workspace.CurrentCamera.CoordinateFrame.X,game.Workspace.CurrentCamera.CoordinateFrame.Y,game.Workspace.CurrentCamera.CoordinateFrame.Z)	
				lv = game.Players.LocalPlayer.Character.Torso.CFrame.lookVector
				torsop = game.Players.LocalPlayer.Character.Head.Position
				game.Players.LocalPlayer.Character.Torso.Neck.DesiredAngle = -(((torsop - camf).Unit):Cross(lv)).Y
			end
		end
	end
end

turnheads()

1 comment

0

If that script was to be run inside of a tool and was a script, make it a localscript and see what happens.

1 answer

hmm try this

for X = 1, math.huge, 0.1 do wait() game.Workspace.LocalPlayer.Torso.Neck.C0 = CFrame.new(0,1.5,0) * CFrame.fromAxisAngle(Vector3.new(0,1,0), X) game.Workspace.LocalPlayer.Torso.Neck.C1 = CFrame.new(0,0,0) end

This discussion is preserved as it was. New answers, comments, and votes are closed.