local function C()if not LocalMouse.Target then return end local C=(LocalCharacter:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")).Position local h=Vector3.new(LocalMouse.Hit.X,LocalMouse.Hit.Y,LocalMouse.Hit.Z)local g=PathfindingService:ComputeSmoothPathAsync(C,h,512)assert(g.Status==Enum.PathStatus.Success,"\080\097\116\104\102\105\110\100\105\110\103 \102\097\105\108\101\100")CurrentPath=g for C,h in next,g:GetPointCoordinates()do local r=nil;(LocalCharacter:WaitForChild("\072\117\109\097\110\111\105\100")):MoveTo(h)repeat wait()r=(h-(LocalCharacter:WaitForChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")).Position).magnitude until r<=4.5 or g~=CurrentPath if g~=CurrentPath then break end end end
------------------------------------------------------------------------------------------------------------------------------------------------------
--  Functions
------------------------------------------------------------------------------------------------------------------------------------------------------

local function CreatePath()
	if not LocalMouse.Target then
		return
	end

	local Origin = LocalCharacter:FindFirstChild("HumanoidRootPart").Position
	local Target = Vector3.new(LocalMouse.Hit.X, LocalMouse.Hit.Y, LocalMouse.Hit.Z)
	local Path = PathfindingService:ComputeSmoothPathAsync(Origin, Target, 512)

	assert(Path.Status == Enum.PathStatus.Success, "Pathfinding failed")
	CurrentPath = Path

	for Index, Point in next, Path:GetPointCoordinates() do
		local Distance = nil
		LocalCharacter:WaitForChild("Humanoid"):MoveTo(Point)

		repeat
			wait()
			Distance = (Point - LocalCharacter:WaitForChild("HumanoidRootPart").Position).magnitude
		until Distance <= 4.5 or Path ~= CurrentPath

		if Path ~= CurrentPath then
			break
		end
	end
end
