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 » Scripting Helpers
Home Search
 

Re: Humanoid Failing to Walk to Part

Previous Thread :: Next Thread 
crazyblox is not online. crazyblox
Joined: 16 Mar 2008
Total Posts: 6139
21 Aug 2013 03:45 PM
It walks to Node 1 correctly, but after it reaches the first node, it walks totally offset from the next node and cannot continue. Please help?

node = 0
nodes = script.Parent:findFirstChild("Nodes")
hum = script.Parent:findFirstChild("Humanoid")

while wait() do
if nodes:findFirstChild("Node"..tostring(node+1)) then
node=tostring(node+1)
else
node=tostring(1)
end
hum.TargetPoint = nodes["Node"..tostring(node)].Position
hum.WalkToPoint = nodes["Node"..tostring(node)].Position
hum.WalkToPart = nodes["Node"..tostring(node)]
repeat wait() until (script.Parent.Torso.Position - nodes["Node"..node].Position).magnitude < 4
end
Report Abuse
ZachBloxx is not online. ZachBloxx
Joined: 26 Jun 2013
Total Posts: 2833
21 Aug 2013 04:00 PM
local node = 0
local nodes = script.Parent:WaitForChild("Nodes")
local hum = script.Parent:WaitForChild("Humanoid")

while wait() do
if nodes:FindFirstChild("Node"..tostring(node+1)) then
node = tostring(node+1)
else
node = tostring(1)
end
hum:MoveTo(nodes["Node"..tostring(node)].Position,nodes["Node"..tostring(node)])
repeat wait() until (script.Parent.Torso.Position - nodes["Node"..node].Position).magnitude < 4
end

-- try that
Report Abuse
crazyblox is not online. crazyblox
Joined: 16 Mar 2008
Total Posts: 6139
21 Aug 2013 04:13 PM
I don't wan't to use the :MoveTo method, as I would like to have the character walk from node1 to 2 then 3,4,5 and then repeat.
Report Abuse
ZachBloxx is not online. ZachBloxx
Joined: 26 Jun 2013
Total Posts: 2833
21 Aug 2013 04:21 PM
If you use the :MoveTo() method on a Humanoid it will walk the character to the position.

http://wiki.roblox.com/index.php/MoveTo
Report Abuse
ZachBloxx is not online. ZachBloxx
Joined: 26 Jun 2013
Total Posts: 2833
21 Aug 2013 04:24 PM
Whoops, wrong page.

http://wiki.roblox.com/index.php/MoveTo_(Method)/humanoid
Report Abuse
crazyblox is not online. crazyblox
Joined: 16 Mar 2008
Total Posts: 6139
21 Aug 2013 04:25 PM
Oh I see, I found it a little confusing that they had the same name. Thanks.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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