Start building

Roblox Pet Follow Script (Smooth Floating Companion)

Makes equipped pets glide smoothly behind the player's shoulder with a lively sine-wave hover and zero physics jitter.

Type: LocalScriptExplorer: StarterPlayer > StarterPlayerScriptsLevel: Intermediate
LocalScriptStarterPlayer > StarterPlayerScripts
-- LocalScript in StarterPlayerScripts
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")

local player = Players.LocalPlayer
local OFFSET = CFrame.new(2.8, 1.4, 3.2)
local SMOOTHNESS = 8

RunService.RenderStepped:Connect(function(dt)
	local char = player.Character
	local root = char and char:FindFirstChild("HumanoidRootPart") :: BasePart?
	local pet = workspace:FindFirstChild(player.Name .. "_Pet") :: Model?
	if not (root and pet and pet.PrimaryPart) then return end

	local bob = math.sin(os.clock() * 4) * 0.45
	local target = root.CFrame * OFFSET * CFrame.new(0, bob, 0)
	local alpha = 1 - math.exp(-SMOOTHNESS * dt)
	pet:PivotTo(pet.PrimaryPart.CFrame:Lerp(target, alpha))
end)

How to install in Studio

  1. Place this LocalScript in StarterPlayer > StarterPlayerScripts.
  2. Give your pet Model a PrimaryPart (Anchored = true, CanCollide = false).
  3. Name the spawned pet model '<PlayerName>_Pet' in Workspace to watch it follow.

Tips & customization

  • Support multiple equipped pets by spacing them in a semicircle behind the player.
  • Using 1 - math.exp(-SMOOTHNESS * dt) makes the motion identical at 60 FPS and 240 FPS.

Common questions.

Why animate pets on the client with RenderStepped?

Client-side CFrame Lerp looks buttery smooth at the player's monitor refresh rate and avoids server network lag.

More free Luau scripts.

All 16 scripts

Skip manual wiring.
Let Revix code & playtest it.

Start building free

Free to start. No card needed.