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


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 
