Head Tracker

Official Head Tracker documentation for installing and configuring smooth local Roblox character head tracking, distance limits, line of sight and avatar compatibility.

On this page

Before you install

Head Tracker is a local character movement system. It does not require a server script, RemoteEvent, DataStore, HTTP request or external service.

The supplied HeadTracking LocalScript is inside the Movements folder. Keep that folder structure when installing the model.

By default, characters track the closest valid player within 25 studs. A target must also be inside the configured viewing range and pass the optional line-of-sight check.

Installation

Move the supplied Movements folder into StarterPlayer > StarterCharacterScripts.

Your Explorer should look like this:

StarterPlayer
└── StarterCharacterScripts
    └── Movements
        ├── HeadTracking
        └── ReadMe

The final folder path is:

game.StarterPlayer.StarterCharacterScripts.Movements

No additional installation is required.

The HeadTracking LocalScript handles the complete runtime.

How it works

Each client calculates head tracking locally for the player characters currently loaded on that client.

For every character, the script checks nearby player heads and selects the closest valid target.

The default behavior is:

  • Maximum tracking distance of 25 studs.
  • 120 degree total horizontal viewing range.
  • 60 degrees to the left and 60 degrees to the right.
  • 70 degrees upward and 70 degrees downward.
  • Optional line-of-sight checking.
  • Smooth movement toward the selected target.
  • Smooth return to the normal forward pose when no target remains.

When another player leaves the allowed range, moves outside the viewing angle, becomes blocked by line of sight or is replaced by a closer valid player, the head transitions naturally instead of snapping.

The script layers the head movement on top of the character’s existing animation so idle, walking, running and other normal animations can continue.

Configuration

The main settings are near the top of the HeadTracking LocalScript.

local MAX_DISTANCE = 25

local MAX_YAW = math.rad(60)
local MAX_PITCH = math.rad(70)

local TRACK_SPEED = 7
local RETURN_SPEED = 3

local TARGET_REFRESH_RATE = 0.05

local REQUIRE_LINE_OF_SIGHT = true

Maximum distance

local MAX_DISTANCE = 25

This controls how close another player must be before they can become a valid target.

A player farther than this distance is ignored.

Horizontal viewing range

local MAX_YAW = math.rad(60)

This allows 60 degrees of movement to the left and 60 degrees to the right.

The complete horizontal viewing range is therefore 120 degrees.

Vertical viewing range

local MAX_PITCH = math.rad(70)

This allows the head to track up to 70 degrees upward or downward.

Tracking speed

local TRACK_SPEED = 7

This controls how quickly the head follows the currently selected player.

Higher values make the movement react faster.

Return speed

local RETURN_SPEED = 3

This controls how quickly the head returns toward its normal forward position after losing a target.

Keeping this lower than TRACK_SPEED creates a softer return instead of an immediate snap.

Target refresh rate

local TARGET_REFRESH_RATE = 0.05

This controls how often the script checks which nearby player should be selected.

The head movement itself remains smooth between target checks.

Line of sight

local REQUIRE_LINE_OF_SIGHT = true

When enabled, the system checks whether another player’s character can be reached without a wall or other blocking object in the way.

Set this to false if your experience does not need line-of-sight filtering.

Multiplayer behavior

Head Tracker remains fully local.

The client does not only calculate the local player’s head direction. It also calculates the expected head direction for other loaded player characters on that client.

For example, if Player1 and Player2 are close enough and are the closest valid targets for each other, the client can display:

Player1 -> Player2
Player1 <- Player2

This allows both characters to appear to look at each other without sending neck rotations through the server.

Every client performs the same type of calculation independently.

Because the result is local, two clients can temporarily display different target choices if their currently loaded objects, positions or line-of-sight results are different.

Avatar compatibility

Head Tracker does not assume that every Roblox avatar uses only a traditional Neck Motor6D.

The script searches for supported neck or head joint setups including:

  • AnimationConstraint
  • Motor6D
  • Compatible Bone joints

This supports newer Roblox avatar joint setups while remaining compatible with traditional character rigs.

The system rotates the physical head or neck connection rather than replacing facial animation controls. Dynamic facial animations can therefore remain separate from the head-tracking movement.

Troubleshooting

The head does not move

Confirm the Movements folder is installed at:

StarterPlayer
└── StarterCharacterScripts
    └── Movements

and confirm HeadTracking is a LocalScript.

Also confirm the character contains:

  • Head
  • HumanoidRootPart
  • Humanoid
  • A supported neck or head joint

A nearby player is not being tracked

A player must pass every active targeting rule.

Check that:

  • The player is within MAX_DISTANCE.
  • The player is inside the horizontal viewing range.
  • The player is inside the vertical viewing range.
  • The player is alive.
  • The line-of-sight check is not blocked when enabled.

A closer valid player will always replace a farther valid target.

The head stops following a player

This is expected when the target:

  • Moves farther than 25 studs.
  • Leaves the configured viewing range.
  • Moves behind a blocking object when line of sight is enabled.
  • Dies or has their character removed.
  • Is replaced by a closer valid player.

The head should smoothly return forward or transition toward the new closest target.

Another player does not appear to look back

The other character uses the same local target rules.

For that character to appear to look back at you on your client:

  • You must be inside their 25 stud range.
  • You must be inside their viewing angles.
  • You must pass their line-of-sight check.
  • You must be their closest valid target.

If another valid player is closer to them, they will look at that player instead.

The head moves in an unexpected direction

Confirm the character uses a normal Roblox head orientation and supported neck connection.

Custom character rigs may require changes to how the target direction is converted into the joint’s local rotation.