How do I prevent my AI from doing this?
Asked by
4 years ago Edited 4 years ago
Whenever the puck/ball goes near the AI, the AI starts to move back and forth for some reason. I am using a BodyPosition to control its movement. Is there any way to prevent the AI from doing this? The old variable is its original position from when the game first loads up and it never changes.
1 | local u = (workspace.ball.ball.Position-script.Parent.Position).unit |
3 | if (workspace.ball.ball.Position-script.Parent.Position).magnitude > 7 then |
4 | bodyPos.Position = old+u* 10 |
6 | bodyPos.Position = old+u*(workspace.ball.ball.Position-script.Parent.Position).magnitude |
AI Bugging Out