How can I make the NPC read the player's position faster?

Hello. I have a script for player movement where I use the SimplePath module. The problem is that the NPC reads the player’s movements too slowly. I tried to loop it but it always starts to lag a lot.

local function BotLogic()

Target = FindNearestPlayer(BRootPart.Position)

if not Target then
	MoveToClosestPoint()
else
	local TCharacter = Target.Character
	local THumanoid = TCharacter and TCharacter:FindFirstChild("Humanoid")
	local TRootPart = TCharacter and TCharacter:FindFirstChild("HumanoidRootPart")

	if not (TRootPart and THumanoid and THumanoid.Health > 0) then
		Target = nil
	else
		local TDistance = (BRootPart.Position - TRootPart.Position).Magnitude
		if TDistance <= AttackDistance then
			if BPath.Status == "Active" then
				BPath:Stop()
			end
			local ChanceGlory
			if THumanoid and tick() - LastAttack > AttackWait then
				ChanceGlory = math.random(0,3)
				print(ChanceGlory)
				LastAttack = tick()
				THumanoid:TakeDamage(Damage)
				AttackTrack:Play()
				PlayerAttack()
				if Target.PlayerEnableGlory.Value == false and ChanceGlory == 3 then
					BotGlory()
				end
			end
		else
			local SDistance = (BRootPart.Position - BStartPosition).Magnitude

			if TDistance > TargetDistance or SDistance >= StopDistance then
				Target = nil
			else
				BPath:Run(TRootPart.Position)
			end
		end
	end
	Moving = nil
end

end


robloxapp-20240706-1505180.wmv (880.0 KB)