I am making a boss battle where the boss goes about his maze randomly, but I can't seem to figure out
how to use PathfindingService
correctly.
local pathservice = game:GetService("PathfindingService") local path = pathservice:ComputeRawPathAsync(script.Parent.Torso.Position, game.Workspace.Stop.Position, 100000) script.Parent.Humanoid:MoveTo(path)
Errors:
Unable to cast Instance to Vector3
The path value I believe is an instance. Isn't there a function for the path itself to get all the points?
EDIT:
read this: http://wiki.roblox.com/index.php?title=Pathfinding#Using_a_path there is a function
-- replace your moveto(path) line with this: points = path:GetPointCoordinates() for _, vec3 in ipairs(points) do script.Parent.Humanoid:MoveTo(vec3) end
also try setting stop's position to a random value between the edges of your map so it won't try to leave the map (not that it will as it just won't do anything)