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

Previous Thread :: Next Thread 
XJonJonX is not online. XJonJonX
Joined: 31 Dec 2013
Total Posts: 14
29 Jul 2014 12:14 AM
This script is edited from 1waffle1's script and is not working.

There are no errors in it, the following just never returns true
'if Path.Status==Enum.PathStatus.Success then'

Source:

local Pathfinding=game:GetService("PathfindingService")
function WalkPath(Goal)
local Path=Pathfinding:ComputeRawPathAsync(script.Parent.Torso.Position,Goal,500)
if Path.Status==Enum.PathStatus.Success then
local Points=Path:GetPointCoordinates()
for i,v in pairs(Points) do
local part,P=workspace:FindPartOnRay(Ray.new(v,Vector3.new(0,-10,0)))
if part then
v=P
Points[i]=P
end
end
local Break=false
local Distance;
for i=1,#Points,2 do
local Point=Points[_]
if Break then
break
end
local Count=0
repeat
Count=Count+1
if Count>100 then
Break=true
break
end
script.Parent.Humanoid:MoveTo(Points[math.min(#Points,i+1)])
if Point.Y>=v.Humanoid.Torso.Position.Y-1 then
script.Parent.Humanoid.Jump=true
end
Distance=(Points*Vector3.new(1,0,1)-script.Parent.Torso.Position*Vector3.new(1,0,1)).magnitude
wait()
until Distance<5
end
else
script.Parent.Humanoid:MoveTo(script.Parent.Torso.CFrame*Vector3.new(0,0,5))
end
end
wait(3)
WalkPath(Vector3.new(0,0,50))
Report Abuse
XJonJonX is not online. XJonJonX
Joined: 31 Dec 2013
Total Posts: 14
29 Jul 2014 07:59 AM
Now I've realized it's not the script

I edited 1waffle1's game, tested it, and it worked, though when I copied the needed models and script into my game, it didn't work...

Anything I need to Enable?
Report Abuse
XJonJonX is not online. XJonJonX
Joined: 31 Dec 2013
Total Posts: 14
29 Jul 2014 08:05 AM
Every time, no matter what I do, the Status is always ClosestNoPath
Report Abuse
super10099 is not online. super10099
Joined: 30 Jan 2010
Total Posts: 1102
29 Jul 2014 08:08 AM
i dunno how to use path finding. maybe you can teach me.
Report Abuse
ClassicalGod is not online. ClassicalGod
Joined: 26 Sep 2008
Total Posts: 2842
29 Jul 2014 08:13 AM
"script.Parent.Humanoid:MoveTo(Points[math.min(#Points,i+1)])"


Humanoid:MoveTo (singlevalue)


Doesn't it need a coord to go to?


How does dat work? :o
Report Abuse
super10099 is not online. super10099
Joined: 30 Jan 2010
Total Posts: 1102
29 Jul 2014 08:14 AM
Using :MoveTo(Vector3.new(0,0,0)

on a humanoid makes them walk to a certain coordinate that was set.
Report Abuse
XJonJonX is not online. XJonJonX
Joined: 31 Dec 2013
Total Posts: 14
29 Jul 2014 08:14 AM
It loops through each Coordinate and moves to it


Point is a Coordinate in the path
Report Abuse
XJonJonX is not online. XJonJonX
Joined: 31 Dec 2013
Total Posts: 14
29 Jul 2014 08:15 AM
P, I mean
Report Abuse
XJonJonX is not online. XJonJonX
Joined: 31 Dec 2013
Total Posts: 14
29 Jul 2014 08:16 AM
http://prntscr.com/47h64i

Hope ROBLOX doesn't mind...

Note, This link is purely for educational purposes.
Report Abuse
Michamos2 is not online. Michamos2
Joined: 24 Jul 2014
Total Posts: 5
29 Jul 2014 08:34 AM
im a scripting noob srry above my level
Report Abuse
Duckywow is not online. Duckywow
Joined: 24 Oct 2013
Total Posts: 6110
29 Jul 2014 09:01 AM
@Jon
What do i need to make this work?
Can you make it simple?
Report Abuse
mu6666mu is not online. mu6666mu
Joined: 09 Apr 2012
Total Posts: 952
29 Jul 2014 09:10 AM
Jon is my Alt

This should be placed in an NPC

local Pathfinding=game:GetService("PathfindingService")
local Char=script.Parent
local Path=Pathfinding:ComputeRawPathAsync(Position1,Position2,MaxDistance)
if Path.Status==0 then
local Points=Path:GetPointCoordinates()
for i,v in pairs(Points) do
Char.Humanoid:MoveTo(v)
repeat wait() until (Char.Torso.Position-v).magnitude <5
end
end


This is the basic script...
Report Abuse
Duckywow is not online. Duckywow
Joined: 24 Oct 2013
Total Posts: 6110
29 Jul 2014 09:21 AM
The script is still not working, i put one in a npc and it just stood.
I have nodes and points, what am i doing wrong?
Report Abuse
mu6666mu is not online. mu6666mu
Joined: 09 Apr 2012
Total Posts: 952
29 Jul 2014 09:35 AM
It's not working for me either, always returns ClosestNoPath for Status
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