local PathfindingService = game:GetService("PathfindingService")
local hum = script.Parent.Humanoid
local torso = script.Parent.Torso
--creando la ruta
local Ruta = PathfindingService:CreatePath()
--calculando la ruta
Ruta:ComputeAsync(torso.Position, game.Workspace.PartFinal.Position)
local puntosRuta = Ruta:GetWaypoints()
for i,v in pairs(puntosRuta) do
hum:MoveTo(v.Position)
end
I’m sorry because you wait so long, what happens is that there are no professional people in this forum (it’s rubbish) I’m going to try to help you…
I’m going to give you several probabilities that might generate the error
-could you instead of:
local puntosRuta = Ruta:GetWaypoints()
for i,v in pairs(puntosRuta) do
hum:MoveTo(v.Position)
end
Haz:
for i,v in pairs(Ruta:GetWaypoints()) do--de esta manera recorre la tabla
hum:MoveTo(v.Position)--gay el que lo lea
end
Or maybe the problem is that you could put it in ServerScriptService.
but the last option and I think the most valid is:
local humano = script.Parent:FindFirstChildOfClass("Humanoid")--tu puta madre
that helps you to see all the Humanoid commands and thus see what is the error and asks there is no error in the output?
Talking about professionalism while providing a completely useless response. Moving the waypoints from a variable directly into a loop has absolutely no effect on the code. Also, the OP already showed a picture of the hierarchy and the humanoid does exist so using FindFirstChildOfClass wouldn’t solve the problem at all.
I do clearly see a problem in the code with regard to the loop. The code is basically moving the humanoid toward the next waypoint without waiting for the humanoid to actually arrive at each individual waypoint. In addition, if you didn’t check the documentation for Humanoid:MoveTo, it says that the operation would time out if the humanoid doesn’t get to the position in 8 seconds.
In case you don’t understand what I mean, I’ll give an example. Let’s say your humanoid is at position 0, and it’s trying to get to position 10. There’s a waypoint table that goes from 1 through 10 marking all the checkpoints between 0 and 10. Your loop then executes. Your humanoid starts moving toward 1, but before it even reaches there, the loop is already on the next iteration going to 2. Then 3, then 4, all the way up to 10. So the humanoid basically goes directly from position 0 to position 10 in a straight path. But since it takes a long time for the humanoid to reach from position 0 to position 10, the code eventually times out after 8 seconds, and your humanoid stops.
That’s my diagnosis of your problem. The link to the Humanoid:MoveTo documentation I posted above actually has a sample piece of code that’s really useful. I would recommend that next time you have a problem search out existing threads, articles, and documentation. Hope this helps.
I clearly see that NOBODY ASKED YOU, at no time did I say that I was a professional, I said that I was going to try to help, I said that maybe because nobody had contributed, I told him to use FindFirstChildOfClass to find out what the Humanoid commands are.
Also, a lot of text is bothersome to read, so use your head and try to write more briefly…
and speaking of professionalism, make the code to see
Thanks to you? The HumanoidRootPart isn’t even a function or child of Humanoid. So your code still didn’t help. One other fact: If the target part is over 100 studs away from the humanoid then the code will fail.