---
title: "Pathfinding and follow script | Universal Roblox Script - ScriptBlox"
description: "Pathfinding and follow script for any Roblox game: Pathfind a player. When they are clicked you follow them and they have a red outline only appears for you"
canonical_url: "https://scriptblox.com/script/Universal-Script-Pathfinding-and-follow-script-110431"
meta:
  "og:description": "Pathfinding and follow script for any Roblox game: Pathfind a player. When they are clicked you follow them and they have a red outline only appears for you"
  "og:image": "https://scriptblox.com/images/script/0-1770851953605.jpg"
  "og:title": "Pathfinding and follow script | Universal Roblox Script - ScriptBlox"
  "twitter:description": "Pathfinding and follow script for any Roblox game: Pathfind a player. When they are clicked you follow them and they have a red outline only appears for you"
  "twitter:image": "https://scriptblox.com/images/script/0-1770851953605.jpg"
  "twitter:title": "Pathfinding and follow script | Universal Roblox Script - ScriptBlox"
---

> Index of every page on this site: [llms.txt](https://scriptblox.com/llms.txt)

![Universal Script 📌](https://scriptblox.com/images/script/0-1770851953605.jpg)

# **Pathfinding and follow script**

[**Universal Script 📌**](https://scriptblox.com/game/universal)**![ScriptDAILY](https://scriptblox.com/images/user-default.webp) [ScriptDAILY](https://scriptblox.com/u/ScriptDAILY)Lv 7Published 5**

10 months ago

[**Get an executor**](https://scriptblox.com/executors?kind=executor)

Please login to perform these actions:

## **Does it work? **

**No reports yet **

No reports yet. Tried it? Be the first to say.

Also noticed:

## Description

Pathfind a player. When they are clicked you follow them and they have a red outline only appears for you

[View Raw](https://scriptblox.com/raw/Universal-Script-Pathfinding-and-follow-script-110431)

```
local PathfindingService = game:GetService("PathfindingService")
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")

local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local rootPart = character:WaitForChild("HumanoidRootPart")

local targetPlayer = nil
local currentHighlight = nil
local path = PathfindingService:CreatePath({
	AgentRadius = 2,
	AgentCanJump = true,
})

-- Function to clean up following state
local function stopFollowing()
	targetPlayer = nil
	if currentHighlight then
		currentHighlight:Destroy()
		currentHighlight = nil
	end
	humanoid:MoveTo(rootPart.Position) -- Stop moving
end

-- Function to follow the target using Pathfinding
local function followTarget()
	while targetPlayer and targetPlayer.Character and targetPlayer.Character:FindFirstChild("HumanoidRootPart") do
		local targetRoot = targetPlayer.Character.HumanoidRootPart
		local destination = targetRoot.Position
		
		-- Only compute path if target is far enough away
		if (rootPart.Position - destination).Magnitude > 5 then
			local success, errorMessage = pcall(function()
				path:ComputeAsync(rootPart.Position, destination)
			end)

			if success and path.Status == Enum.PathStatus.Success then


```

## **Comments **

**0**

Log in to join the conversation. [**Login **](https://scriptblox.com/login?redirect=/script/Universal-Script-Pathfinding-and-follow-script-110431)

No comments yet. Be the first!

```json
{"@context":"https://schema.org","@type":"SoftwareSourceCode","@id":"https://scriptblox.com/script/Universal-Script-Pathfinding-and-follow-script-110431#script","url":"https://scriptblox.com/script/Universal-Script-Pathfinding-and-follow-script-110431","name":"Pathfinding and follow script","programmingLanguage":"Lua","runtimePlatform":"Roblox","author":{"@type":"Person","name":"ScriptDAILY","url":"https://scriptblox.com/u/ScriptDAILY"},"datePublished":"2026-02-11T23:19:13.615Z","image":"https://scriptblox.com/images/script/0-1770851953605.jpg","isAccessibleForFree":true}
```

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://scriptblox.com/#website","@type":"WebSite","description":"Search free Roblox scripts uploaded by the community, with live status for every major executor. Browse by game, copy the loadstring and run it in your executor.","inLanguage":"en","name":"ScriptBlox","url":"https://scriptblox.com/"},{"@id":"https://scriptblox.com/script/Universal-Script-Pathfinding-and-follow-script-110431#webpage","@type":"WebPage","description":"Pathfinding and follow script for any Roblox game: Pathfind a player. When they are clicked you follow them and they have a red outline only appears for you","name":"Pathfinding and follow script | Universal Roblox Script - ScriptBlox","url":"https://scriptblox.com/script/Universal-Script-Pathfinding-and-follow-script-110431","breadcrumb":{"@id":"https://scriptblox.com/script/Universal-Script-Pathfinding-and-follow-script-110431#breadcrumb"},"isPartOf":{"@id":"https://scriptblox.com/#website"},"mainEntity":{"@id":"https://scriptblox.com/script/Universal-Script-Pathfinding-and-follow-script-110431#script"},"potentialAction":[{"@type":"ReadAction","target":["https://scriptblox.com/script/Universal-Script-Pathfinding-and-follow-script-110431"]}]},{"@id":"https://scriptblox.com/script/Universal-Script-Pathfinding-and-follow-script-110431#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Home","item":"https://scriptblox.com","position":1},{"@type":"ListItem","name":"Universal","item":"https://scriptblox.com/game/universal","position":2},{"@type":"ListItem","name":"Pathfinding and follow script","position":3}]}]}
```

## Sitemap

See the full [sitemap](https://scriptblox.com/sitemap.md) for all pages.
