generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

NPC walking (MoveTo() ); how to cancel ?

Previous Thread :: Next Thread 
Bobogijoe is not online. Bobogijoe
Joined: 04 Mar 2010
Total Posts: 640
23 Dec 2014 02:07 PM
(I know this forum is not for scripting questions, but I didn't find the appropriate one...)

Iv'e made an NPC character and he walks around (done with the Humanoid's MoveTo() method ). When he detects a player nearby, he then starts to chase it. The problem is that he is still trying to acheive the first point he was walking to when he starts chasing... So I was wondering... is there a way to stop the MoveTo() method, to abort it?

thanks.Gnomes.

Report Abuse
iProfitRobux is not online. iProfitRobux
Joined: 30 Nov 2014
Total Posts: 247
23 Dec 2014 02:08 PM
Maybe MoveTo(0,0,0)?
Report Abuse
Funse is not online. Funse
Joined: 11 Jun 2012
Total Posts: 7887
23 Dec 2014 02:09 PM
break;
Report Abuse
Bobogijoe is not online. Bobogijoe
Joined: 04 Mar 2010
Total Posts: 640
23 Dec 2014 02:14 PM
If I send it walking to (0,0,0), its just another task it adds to its "list of tasks".

And that's just it: I can't break. Because the MoveTo() method is like a coroutine acting on the humanoid and once you fire it... it won't stop until it's acheived.

I would like to "End task". ...
Report Abuse
Bobogijoe is not online. Bobogijoe
Joined: 04 Mar 2010
Total Posts: 640
23 Dec 2014 02:16 PM
Well atleast thats how I think it works
Report Abuse
Funse is not online. Funse
Joined: 11 Jun 2012
Total Posts: 7887
23 Dec 2014 02:17 PM
You could use break if your using moveto in a for loop.
for i=0,10,1 do
nub.Humanoid:MoveTo(nub.Torso.Position + Vector3.new(0,i,0))
if i == 9 then
break;
end
end
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
23 Dec 2014 02:20 PM
Or you could go with the perfectly logical answer, make them walk to the position they are currently standing on....
Report Abuse
Bobogijoe is not online. Bobogijoe
Joined: 04 Mar 2010
Total Posts: 640
23 Dec 2014 02:22 PM
Yeah that's what I did to try and stop them. It does. He stops moving but hes legs are still walking (in place)... I'll investigate some more...
TO THE STUDIO!
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
23 Dec 2014 02:22 PM
I mean, that just sounds a lot less complicated than what you are doing at the moment.

Also, I am trying to help a member of GnomeWorks :D
They were hiring, but I would have been too lazy to do much. So at least my conscience is clear now.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
23 Dec 2014 02:22 PM
Oh. That is very interesting. I have no idea why that happens, actually.
Report Abuse
Bobogijoe is not online. Bobogijoe
Joined: 04 Mar 2010
Total Posts: 640
23 Dec 2014 02:26 PM
Probably some script logic I've overseen. And thank you Jarod. (I'm working on GnomeWorks newest project).

Report Abuse
joelsdarkside22 is not online. joelsdarkside22
Joined: 18 Mar 2009
Total Posts: 1131
23 Dec 2014 02:44 PM
humanoid:MoveTo(humanoid.Parent.Torso)
Report Abuse
joelsdarkside22 is not online. joelsdarkside22
Joined: 18 Mar 2009
Total Posts: 1131
23 Dec 2014 02:47 PM
Whoops, didn't see Jarod's post.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image