This is a one-sentence summary. Silly mods.
Solution: I'm going to try to make different parts that are in the correct position relative to the AI and the player, then move the AI to those points. I will then use CFrame to rotate it correctly.
Original post: I want to simulate mouselock or moonwalk (first person) in an AI. Basically if someone comes close enough the bot will walk side to side, jabbing forwards and backwards, while always facing its target.
AutoRotateCharactermust be set to false, so the bot can move while still facing it's target.
Getting the target would be relatively simple code, but the part I'm not sure how to do is actually move the bot back and fourth, forward and backward, relative to the target. I can't just move it between two points on a map, because then the player could just go around the bot. I want the bot to remain facing the target. I'm not sure how to accomplish this.
This is not a request, because I'm not asking for code. I'm simply asking for ideas.
Any answers are appreciated, but please try to be as detailed as possible.
Make a script that will track how close the player is to the bot, put pathfinding onto it so it doesn't get stuck into a wall, now when it's found you need to make it follow the player until the distance has not been met.
I hope I helped.
Adding onto what CharcterKaiser said, you could always try to get the bot within a certain lunging distance of the player, and then it would attempt to lunge while pathfinding a route backwards, if the route isn't possible look for back left and back right, if that's not possible try to lunge jump over the player. I know this isn't a full answer that you are looking for but it may be a start.