Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How Can I Set The WalkToPart Property of Humanoid to Nil?

Asked by 5 years ago
Edited 5 years ago

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.

1 answer

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

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

Ad

Answer this question