function MakePath(startposition, endposition)
local Path:Path -- is path the name of the variable? what does the ":Path" do at the end of the variable?
Path = PathfindingService:CreatePath() -- i think this makes the Path variable into a Path instance?
Path:ComputeAsync(startposition, endposition) -- function for Path instances which contains where the NPC should walk to reach the goal
if Path.Status == Enum.PathStatus.Success then -- if the NPC reaches the goal
return Path
else
repeat task.wait(0.1) until Path.Status == Enum.PathStatus.Success -- wait until the NPC reaches the goal
end
end
function WalkZombie(Humanoid, startposition, endposition)
local Path = MakePath(startposition, endposition)
local WayPoints = Path:GetWaypoints() -- function which returns a table of positions the NPC should walk to in order to reach the goal
local CurrentWayPoint = 1 -- waypoint the NPC is walking on
local FinishedConnection:RBXScriptConnection -- i have absolutely no clue what this is
end
So I just followed a tutorial on PathFindingService the other day, and they use some terms which are fairly confusing for me. Please note that what I have above is only a very small piece of the script, I just included the things that I am confused about.
I left comments on each line I related to PathFindingService, if anyone could explain the pieces I don’t know, and confirm the pieces I left comments on, that would be extremely helpful