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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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 |
|
|