When you do Humanoid:MoveTo(pos, part)
, it goes to pos
based on the part
, which is defined in the Humanoid's WalkToPart
property. WalkToPart
actually never goes away if you were to do Humanoid:MoveTo(Humanoid.Torso.Position, nil)
to clear that WalkToPart
property. Because of this, if you had set the WalkToPart
property and later wanted to go to another point via MoveTo
, the WalkToPart
property would remain there and would offset where the character goes.
How would I manually set the Humanoid's WalkToPart
property to nil
? I really can't think of any way except setting the second argument of MoveTo
to nil, which doesn't seem to work. Maybe it's because back when you set the second argument of MoveTo
to the part, that moveTo never finished? I am not sure and that shouldn't happen because of the 8 second timeout.
There's a code sample here on the Roblox API that provides a solution to being able to change the target. Actually when you pass in the target, you probably don't need to call it again, but just be sure to use the same variable that was passed in.. change it.. and call it again for redundancy. This will ensure a smooth transition to then next target, I believe.
https://developer.roblox.com/en-us/api-reference/function/Humanoid/MoveTo