You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
i wanna make a path finding -
What is the issue? Include screenshots / videos if possible!
cannot compute the path and :GetWaypoints() returns empty table -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
i already searched the developer hub and i didnt find any solution
this is the code:
local seats
for i,v in pairs(game.Workspace.Terrain.Restaurant.Tables:GetDescendants()) do
if v.Name == "Seat" then
if not v.Occupant then
print(v.Occupant)
seats = v
break
elseif i == #game.Workspace.Terrain.Restaurant.Tables:GetDescendants() then
end
end
end
repeat
wait()
until seats
wait()
local pathSrv = game:GetService("PathfindingService")
local path = pathSrv:CreatePath()
path:ComputeAsync(script.Parent.Torso.Position, game.Workspace.TpPart.Position)
print(script.Parent.Torso.Position)
local ways = path:GetWaypoints()
print(ways)
for i,v in pairs(ways) do
script.Parent.Humanoid:MoveTo(v.Position)
script.Parent.Humanoid.MoveToFinished:Wait()
end
please help!