Hello, I have this script which makes an NPC Bot follow a player. I attempted to make the bot always stay behind the player at a good distance but I had an issue if the player is facing a different direction? How can I make it always go behind the Player no matter the way they are facing.
while FollowMaster == true do
if (game.Players.CrazyCorrs.Character.HumanoidRootPart.Position-script.Parent.HumanoidRootPart.Position).Magnitude > 5 then
script.Parent.Humanoid:MoveTo(game.Players.CrazyCorrs.Character.HumanoidRootPart.Position-Vector3.new(0,0,-2.3))
end
wait()
end

3 comments
Thanks
So glad I was able to help you. I forgot about mentioning an article if you wanna learn more about CFrames so here you go: https://developer.roblox.com/en-us/articles/Understanding-CFrame
And if your question was answered please mark it as so :D