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
 

Re: Yield code until position reached?

Previous Thread :: Next Thread 
InfiniteYield is online. InfiniteYield
Joined: 01 Mar 2012
Total Posts: 762
10 Sep 2017 02:43 AM
Hi! I'm using the pathfinding service for my NPC, however it generates paths too often, and too quickly when the target is moving. How would I tell the script to yield the code until the next point is reached?
I've tried repeat wait() until npc.HumanoidRootPart.Position = v (v, being the vector3 position of the current target to walk too)




Report Abuse
InfiniteYield is online. InfiniteYield
Joined: 01 Mar 2012
Total Posts: 762
10 Sep 2017 02:52 AM
boop


Report Abuse
cabbler is not online. cabbler
Joined: 19 Jun 2015
Total Posts: 735
10 Sep 2017 02:58 AM
Well you should be iterating through the path points array so it's done when that's done
Report Abuse
22618709 is not online. 22618709
Joined: 25 Dec 2011
Total Posts: 19221
10 Sep 2017 03:26 AM
http://wiki.roblox.com/index.php?title=API:Class/Humanoid/MoveToFinished



READ THIS IF YOU'RE LOOKING FOR A SCRIPTER: https://forum.roblox.com/Forum/ShowPost.aspx?PostID=222340785
Report Abuse
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
10 Sep 2017 03:45 AM
repeat wait() until (script.Parent.Torso.Position - Target.Position).magnitude <= 4
Report Abuse
TheCoderOfLua is not online. TheCoderOfLua
Joined: 12 Apr 2016
Total Posts: 1599
10 Sep 2017 03:49 AM
lua basics answer is basic, 2281729 or whatever has best answer.
Report Abuse
LaeMVP is online. LaeMVP
Joined: 24 Jun 2013
Total Posts: 4416
10 Sep 2017 03:50 AM
Humanoid.MoveToFinished:Wait()
Report Abuse
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
10 Sep 2017 03:57 AM
@Coder I've known about that but it doesn't 100% work because it has to perfectly reach the location so I recommend that you just use a magnitude loop because its more reliable all though more demanding.
Report Abuse
TheCoderOfLua is not online. TheCoderOfLua
Joined: 12 Apr 2016
Total Posts: 1599
10 Sep 2017 04:03 AM
Well I've used both, tbh, and in my case it doent always register on 4 magnitude. Sometimes you have to put to 7, and thta leads to inaccuracy.


My advice, use MoveToFinished,

But for the sake of if it gets derailed a bit, or something, put MoveTo in a loop to desired position.
Report Abuse
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
10 Sep 2017 04:05 AM
;o next time don't call me 'basic' just because im well basic hehe
Report Abuse
LaeMVP is online. LaeMVP
Joined: 24 Jun 2013
Total Posts: 4416
10 Sep 2017 04:06 AM
basic ^
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