I'm having an npc walk to a random seat and sit, and since there are stuff in the way I'm using the Pathfinding Service. It works for some seats, but for the other seats it just teleports them there

Here is part of my script (not the whole one, everything else is working)

local ranSeat
local function randomSeat()
	for _,seat in pairs(ranTable:GetDescendants()) do
		if seat:IsA("Seat") then
			if seat.Occupant == nil then
				ranSeat = seat
				break
			end
		end
	end
end
randomSeat()
wait()
local path = PathfindingService:CreatePath()
path:ComputeAsync(npc.HumanoidRootPart.Position,ranSeat.Position)
local waypoints = path:GetWaypoints()
for _,waypoint in pairs(waypoints) do
	humanoid:MoveTo(waypoint.Position)
	humanoid.MoveToFinished:Wait()
end
randomSeat()
wait()

??? Help? I copied some of it directly from the wiki

3 comments

1

do they get literally CFramed into the seats?

0

Yeah they literally teleport to the seat but I fixed the problem

0

I had to add more wait time everytime the npc reached the waypoint, it was going too fast i guess