NPC are not moving correctly

What? Pathfinding service should go to that specific waypoint, and if it didn’t, like @OfficialPogCat said they can use costs.

I’m trying to be friendly here since it seems like you’re attacking me in every reply you make.

3 Likes

HOW WILL YOU GO TO THAT POINT IF IT WOULD NOT BE THE SHORTEST ROUTE? waza?

2 Likes

Look, don’t pay attention to those guys, or to me because @Scottifly has the solution

1 Like

My bad, I thought you were using PathFinding. This isn’t related to your issue, but could become an issue as Humanoid:MoveTo() has a 8 second limitation. Do as you want idc, just feel bad if you didn’t know this limitation which is why I thought you were using Pathfinding (Pathfinding using waypoints so this doesn’t really become an issue within pathfinding, as it adds more waypoints if it can’t reach a point within 8 seconds). But you can do it the way you are currently as long as you respect this limitation (boss was moving slow so for slow entities you might have issues)

3 Likes

They are using waypoints via a part, next part etc. Froward, left and right are the shortest paths since it won’t go for the exit directly. They could just go to the exit if they used costs since it wouldn’t go off track.

2 Likes

What are the recommendations for solving this? ahorita tengo el mismo problema encerre el MoveTo() en un loop y no work
edit: Why MoveTo() Not Working

1 Like

Using Pathfinding is a well solution but sometimes can’t always be used. Setting the NetworkOwnership of the moving model to nil (The server) can help, and finally doing some repeat task.wait until magnitude is around 5 of its goal checks instead of using Humanoid.MoveToFinish. There is many different things as well to try in this case and I only named a few, doing more searches can help fix your issue or doing trial and error tests which I find most useful in my case.

2 Likes

I already fixed this problem

local Finished = false
local EndEvent 

for i,v in pairs(WayPoints) do
	if Char.Parent and Hum.Health > 0 then
		Char.MovingTo.Value = v.Instance
		
		local ToPos = v[1].Position
		Hum:MoveTo(ToPos,v.Instance)
		
		local Part = GetPart()
		Part.Parent = workspace
		Part.Position = ToPos
		
		EndEvent = Hum.MoveToFinished:Connect(function(reached)
			if reached then
				Finished = true
           else
				Hum:MoveTo(ToPos)
			end
		end)
		repeat
			if not Char.Parent or Hum.Health <= 0 then
				Finished = true
			end
			task.wait()
		until Finished
		EndEvent:Disconnect()
		Finished = false
	end
end
1 Like

Make sure you mark a post to your solution (so people don’t reply here giving you info about your problem that you already have fixed). The 8 second limitation isn’t a issue you had, but if Humanoid:MoveTo() takes longer then 8 seconds, MoveToFinish won’t fire. I was mentioning it but it wasn’t an issue you had based on what I saw, but just as an issue to be aware about!

1 Like

my problem was not solved, I just wanted to say that the problem of 8 seconds I did not have. however the npc still aren’t going correctly to the indicated point.

1 Like

remember that at a certain point it gives that error, anyway, the first post solved it is sencille

Please show us a top view picture in Studio, with your Boss model selected using the Move tool.
This is so we can see where the Pivot of the model is set to.

I did the test and it did not help in the cycle, I did the same with the previous method and there was no problem, although I know that sometimes the MoveTo() will be damaged, I want to know why it happens.

I was able to fix this error with AlignPosition and AlignOrientation, thanks everyone for helping.

Hey, according to what I see, you haven’t fixed it because if it doesn’t move, wait 8 seconds to move again, do you call that a solution?

I don’t have this problem anymore because I’m not using a humanoid function anymore, just dealing with the physics with alignposition.
but those 8 seconds is not the problem either. you can just do a “MoveToFinished” function, it returns a value true if it was finished and false if it exceeded 8 seconds, you see then that you have reached and call the move again.
Captura de tela 2023-08-19 151529

after he has successfully finished the “MoveToFinished” you can disconnect the function now. EndEvent:Disconnect()

ok I am seeing that you use a similar function but with some changes (WaltToPart), at some point it will stop for 8 seconds

test this function to see if it helps you.

1 Like

ok, tell me which function was the one that helped you, I find it interesting, did you use this method? I found out that if the distance is greater than 6>5 tacos it will not move https://www.youtube.com/watch?v=Ylt7H6_2stU

Try this.

local Humanoid = nil
local Pos = Vector3.new()
Humanoid:MoveTo(Pos) -- Vector3
local EndEvent
EndEvent = Humanoid.MoveToFinished:Connect(function(reached)
	if reached then
		EndEvent:Disconnect()
	else
		Humanoid:MoveTo(Pos)
	end
end)