So I made two Humanoid people. One of them is named AI and the other Test. At first when I ran the script it would make the character move to to the Test's direction, but just in a straight line. Which means I had to make a loop right? So I did, and now it doesn't move at all!Plus I have no output... Please help guys.
~The Script~
01 | local a = game.Workspace:FindFirstChild( "Test" ) |
02 | local b = script.Parent |
03 |
04 |
05 | if a then |
06 |
07 | local path = game:GetService( "PathfindingService" ) |
08 |
09 | while wait( 4 ) do |
10 | local route = path:ComputeRawPathAsync(b.Torso.Position, a.Torso.Position, 200 ) |
11 | if route.Status = = "Enum.PathStatus.Success" then |
12 | b.Humanoid:Move(a.Torso.Position) |
13 |
14 |
15 | end |
16 |
17 | end |
18 | end |
1 | local a = game.Workspace:WaitForChild( "Test" ) |
2 | local b = script.Parent |
3 | local path = game:GetService( "PathfindingService" ) |
4 | -- I'm not sure why you're using a loop. It usually only has to run ONCE to get to the point. Or else major lag would occur. |
5 | local route = path:ComputeRawPathAsync(b.Torso.Position, a.Torso.Position, 200 ) |
6 | if route.Status = = Enum.PathStatus.Success then |
7 | b.Humanoid:WalkToPoint(a.Torso.Position) -- Changed to WalkToPoint because Move isn't a thing? |
8 | end |