# Roblox pet follow script: how to make a pet follow you

> A Roblox pet follow script with AlignPosition and AlignOrientation. Set up the pet model, make it follow you smoothly and fix lag, falling and spinning.

Source: https://synagy.org/blog/roblox-pet-follow-script
Published: 2026-12-04
By: the Synagy team (https://synagy.org)

**Short answer:** a Roblox pet follow script needs two constraints on the pet. An AlignPosition pulls it toward an Attachment behind the player, and an AlignOrientation turns it the same way. Create both from a server Script when the character spawns. Unanchor and weld the pet first, then give its network ownership to the player. Responsiveness, which ranges from 5 to 200, sets how tightly the pet keeps up.

This guide walks through the pet model, the full script, several pets in a row and the bugs people hit most. Everything below was checked against the Roblox Creator Docs on December 4, 2026. It does not cover pet inventories, saving or egg hatching. Those get their own guides on our [Roblox pets topic page](https://synagy.org/blog/topic/roblox-pets).

## Which way should a pet follow the player?

Use constraints. AlignPosition and AlignOrientation move the pet with physics, so it eases toward the player instead of jumping. Older tutorials use BodyPosition and BodyGyro, but the [BodyPosition reference](https://create.roblox.com/docs/reference/engine/classes/BodyPosition) is now tagged as deprecated.

There are 5 common ways to do it. They differ in smoothness, in who sees the pet and in how much code they need.

| Method | Smooth for the owner | Other players see it | Status |
|---|---|---|---|
| AlignPosition + AlignOrientation, owned by the player | Yes | Yes | Current, the method in this guide |
| CFrame updates in a LocalScript every frame | Yes | Only if every client draws every pet | Current, common in big simulators |
| Server loop that sets the CFrame | No, it moves in steps | Yes | Works, but looks choppy |
| BodyPosition + BodyGyro | Yes | Yes | Deprecated |
| Pet with a Humanoid and MoveTo | Walks on the ground | Yes | Current, but needs a walk animation |

The client-only method is the smoothest. It also means writing your own system to show other players' pets. For a first pet, the constraint method is the best trade: one server Script of about 50 lines, and every player sees the pet.

## How do you set up the pet model?

Build the pet as one Model with a root part, weld every other part to that root, and unanchor everything. A pet that is anchored will never move, and one without welds falls apart.

**Prepare a pet model in six steps**

1. **Group it**: select all parts, press Ctrl+G, name the model Pet
2. **Pick a root**: set the model's PrimaryPart to its body or a small invisible box
3. **Weld it**: add a WeldConstraint from each part to the root
4. **Unanchor**: turn off Anchored on every part
5. **No collisions**: turn off CanCollide so the pet never pushes you
6. **Store it**: move the model into ServerStorage

1. Group the parts of your pet with **Ctrl+G** and name the model `Pet`. A mesh from Blockbench or the Toolbox works the same way.
2. Select the model and set **PrimaryPart** in the Properties window. The [Model reference](https://create.roblox.com/docs/reference/engine/classes/Model) notes that models have no PrimaryPart by default.
3. Right-click the root part in the Explorer, choose **Insert Object** and add a **WeldConstraint** for each other part. Set Part0 to the root and Part1 to the other part.
4. Turn off **Anchored** on every part, including the root.
5. Turn off **CanCollide**. Also turn off CanQuery if your weapons use raycasts, so shots pass through pets.
6. Drag the finished model into **ServerStorage**.

> **Tip:** turn on **Massless** for every part except the root. The [BasePart reference](https://create.roblox.com/docs/reference/engine/classes/BasePart) says Massless is ignored on an assembly's root part. A light pet needs much less force to float.

## How do you write the pet follow script?

Put one Script in ServerScriptService. When a character spawns, it clones the pet, adds an Attachment to the pet and a second one to the character's HumanoidRootPart, and links them with the two constraints.

```lua
-- Script in ServerScriptService
local Players = game:GetService("Players")
local ServerStorage = game:GetService("ServerStorage")

local petTemplate = ServerStorage:WaitForChild("Pet")
local OFFSET = Vector3.new(3, 1, 3) -- 3 right, 1 up, 3 behind
local petsByPlayer = {}

local function removePet(player)
	if petsByPlayer[player] then
		petsByPlayer[player]:Destroy()
		petsByPlayer[player] = nil
	end
end

local function givePet(player, character)
	removePet(player)
	local rootPart = character:WaitForChild("HumanoidRootPart")
	local pet = petTemplate:Clone()
	local petRoot = pet.PrimaryPart

	local petAttachment = Instance.new("Attachment")
	petAttachment.Parent = petRoot

	local slot = Instance.new("Attachment")
	slot.Name = "PetSlot"
	slot.Position = OFFSET
	slot.Parent = rootPart

	local alignPosition = Instance.new("AlignPosition")
	alignPosition.Attachment0 = petAttachment
	alignPosition.Attachment1 = slot
	alignPosition.Responsiveness = 25
	alignPosition.MaxForce = 25000
	alignPosition.Parent = petRoot

	local alignOrientation = Instance.new("AlignOrientation")
	alignOrientation.Attachment0 = petAttachment
	alignOrientation.Attachment1 = slot
	alignOrientation.Responsiveness = 25
	alignOrientation.MaxTorque = 25000
	alignOrientation.Parent = petRoot

	pet:PivotTo(slot.WorldCFrame)
	pet.Parent = workspace
	petsByPlayer[player] = pet
	petRoot:SetNetworkOwner(player)
end

Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		givePet(player, character)
	end)
end)
Players.PlayerRemoving:Connect(removePet)
```

What each part does:

- **The offset.** An Attachment's Position is measured in its parent part's own space. Roblox parts face along their negative Z axis, so a positive Z puts the slot behind the player.
- **Two attachments.** In the default TwoAttachment mode, the [AlignPosition reference](https://create.roblox.com/docs/reference/engine/classes/AlignPosition) says the constraint moves Attachment0 to the position of Attachment1. Attachment0 sits on the pet, Attachment1 on the player.
- **PivotTo.** The [PVInstance reference](https://create.roblox.com/docs/reference/engine/classes/PVInstance) calls PivotTo the main way to move models by script. It places the pet in its slot before it appears, so it does not fly in from wherever you built the template.
- **The cleanup.** Each respawn removes the old pet before it adds a new one. A player who leaves takes their pet along.

The player is never dragged around. The [AlignPosition guide](https://create.roblox.com/docs/physics/constraints/align-position) says that with ReactionForceEnabled off, the default, the constraint only pushes Attachment0. Attachment1 stays unaffected.

## Why does the pet lag behind the player?

The pet lags when the server simulates it. Each position then has to travel to the player's device first. Calling SetNetworkOwner(player) on the pet's root hands the physics to the player's device, so the pet moves in step with the character.

The [network ownership page](https://create.roblox.com/docs/physics/network-ownership) adds two rules:

- You cannot set ownership on anchored parts. The server always owns them, which is one more reason to unanchor the pet.
- Roblox cannot check physics on parts a client owns. A cheater can teleport such a part or send fake Touched events. Never let a pet's touch give coins or deal damage without a check on the server.

**Server Authority games skip SetNetworkOwner**

Roblox released [Server Authority](https://devforum.roblox.com/t/full-release-ship-fair-and-competitive-games-with-server-authority/4727993) on July 9, 2026. It is opt-in. The [Server Authority docs](https://create.roblox.com/docs/projects/server-authority) say it does not allow client network ownership. They also say the client predicts every part connected to a predicted character through welds, joints or constraints. With Workspace.AuthorityMode set to Server, delete the SetNetworkOwner line.

## How do you tune how the pet moves?

Change Responsiveness first. The other properties only cap the force and speed. The [AlignPosition reference](https://create.roblox.com/docs/reference/engine/classes/AlignPosition) calls MaxForce and MaxVelocity caps and says the actual scale comes from Responsiveness.

**5–200 | allowed Responsiveness on both constraints**

- **25**: Responsiveness in the script above
- **16**: studs per second, the default walk speed
- **2**: constraints per pet

| Property | What it does | Try this |
|---|---|---|
| Responsiveness | How fast the pet closes the gap | 10 to 15 for a lazy float, 40 or more for a tight follow |
| MaxForce | The most force the constraint may use | Raise it if a heavy pet sinks below its slot |
| MaxVelocity | The top speed while it catches up | Leave it unless the pet overshoots |
| RigidityEnabled | Off by default; on makes the solver align as fast as it can | Keep it off, or the pet moves like it is welded |
| AlignOrientation MaxTorque | How hard the pet turns to face your way | Raise it if the pet turns slowly |

The 16 studs per second come from the [Humanoid reference](https://create.roblox.com/docs/reference/engine/classes/Humanoid). If your game has sprinting, test the pet at your top speed. A low Responsiveness lets it fall far behind.

## How do you make several pets follow one player?

Give every pet its own slot Attachment and spread the slots in an arc behind the player. The rest of the script stays the same.

```lua
local RADIUS = 5

local function slotOffset(index, count)
	local angle = (index / (count + 1) - 0.5) * math.pi
	return Vector3.new(math.sin(angle) * RADIUS, 1, math.cos(angle) * RADIUS)
end
```

Use `slotOffset(i, count)` instead of the fixed OFFSET for pet number i. With 3 pets, the slots sit 5 studs away at −45°, 0° and 45° behind the player. When a pet is added or removed, set every slot's Position again with the new count.

## Why does a pet not follow the player?

Most failures come from an anchored part, missing welds or collisions. Check the Output window for errors, then go down this table.

| What you see | Likely cause | Fix |
|---|---|---|
| The pet does not move at all | A part is still anchored | Turn off Anchored on every part |
| The pet falls apart | Parts are not welded to the root | Add a WeldConstraint for each part |
| The pet trips or pushes the player | CanCollide is on | Turn off CanCollide on every part |
| The pet stutters for its owner | The server simulates it | Call SetNetworkOwner(player) |
| The pet sinks below its slot | MaxForce is too low for its mass | Raise MaxForce or set Massless on child parts |
| The pet spins or tips over | No AlignOrientation | Add AlignOrientation to the same two attachments |
| The pet flies across the map after a teleport | It chases the new slot | Call PivotTo on the pet right after the teleport |
| Output shows "attempt to index nil with 'SetNetworkOwner'" | The model has no PrimaryPart | Set PrimaryPart before you store the model |

## Where does this method stop?

The pet floats at a fixed height next to the player's root part. On stairs it rises and falls with the player, not with the ground. That suits flying pets, ghosts and orbs. A dog that trots on the floor needs a different build.

For a walking pet, give it a Humanoid, call MoveTo toward a point behind the player and play a walk animation. The Humanoid reference says MoveTo gives up after 8 seconds if the goal is not reached, so call it again on a loop. Our guide on [how to animate an NPC in Roblox Studio](https://synagy.org/blog/animate-npc-roblox-studio) covers rigs, walk clips and the script that plays them.

If you would rather not rig and animate each pet by hand, Synagy is an upcoming tool for that. It is being rebuilt and is not open yet. The plan: you describe a pet and pick Roblox, and you get a `.rbxm` model with a rig and four animations (idle, walk, attack, death), checked first in a live 3D preview. The follow script above works with any pet model either way. The [waitlist on synagy.org](https://synagy.org/) gives you a permanent Founder number.

## FAQ

### How do you make a pet follow you in Roblox without lag?

Move the pet with AlignPosition and AlignOrientation, then call SetNetworkOwner(player) on its root part from the server. The player's device then simulates the pet together with the character. In games that use Server Authority, skip SetNetworkOwner, because Roblox predicts constrained parts on its own.

### Should a pet follow script be a Script or a LocalScript?

Use a server Script in ServerScriptService for the constraint method. The server creates the pet, so every player sees it. A LocalScript only fits the client-only method, where each player's device moves and draws every pet by itself.

### Can a Roblox pet walk on the ground instead of floating?

Yes, but not with this script alone. Give the pet a Humanoid, move it with MoveTo toward a point behind the player and play a looped walk animation. MoveTo times out after 8 seconds, so call it again regularly while the player moves.

### Is BodyPosition still fine for a pet follow script?

It still runs in many old games, but Roblox tags BodyPosition as deprecated. New pets should use AlignPosition and AlignOrientation. They do the same job, take two attachments instead of a target position, and get current support from Roblox.

### How far behind the player should a pet float?

A slot about 3 studs to the side and 3 studs behind keeps a small pet visible without blocking the camera. Bigger pets need more room. Change the OFFSET vector, test in Play mode and move the slot until the pet stays out of the way.
