Little question about NPC chasing player

Hello, in some games, the NPC chasing the player will take the same path as the player without actually going on the player, so if the player goes behind a wall then the NPC will follow this same path to not face the wall and be bugged in some way.

Does this means that from the moment the monster detects the player, I must save in a table the CFrames of the character at each frame and program the Npc to move to all the CFrames one by one until it comes face to face with the player? Or there is a better way ?

Thank you for your helps or advices

You don’t really need to do it manually like that, read up on pathfinding. I think TheDevKing also has some good tutorials on it.

I have already looked at this and the pathfiding service of roblox does not allow to make such a system, it just allows to have certain reactions face of certain obstacles

Oh, you want an exact follower. Yeah you could do the stated method in the question, but remember not to repeat the same positions next to each other unless you want the monster to stop at the same places as the player.

Hello, if anyone has any information about this it would be great. My little theory is that as soon as the NPC starts chasing the player, then it adds in a table the player’s CFrames for example every 0.1 seconds while RayCasting the NPC to the player in order to detect if he’s behind a wall (depending on the Raycast response) , and if he’s not then clear the table, move on the location and start a new CFrame table of the player. what do you think about this ? Does it seem a normal way ? Thank you again

I would keep a running CFrame table and remove the positions as the monster moves to them.