Simple question, is it possible to make a pathfinding NPC work on a moving part? I have a spinner for my obby’s tutorial and want to know if I can automatically have it pathfind or if I need to make my own path with :MoveTo and calculate magnitudes and whatnot?
It is, actually. You can use a while loop for it so it constantly finds the part. To get the npc to move towards to moving part do
local wps = path:GetWaypoints()
npc.Humanoid.WalkToPart = wps[#wps].Position
Then you can have it delete the OLD table of parts to reduce lag.
Outside of the loop do
local old == nil
Then inside the while loop something like:
local wps = path:GetWaypoints()
npc.Humanoid.WalkToPart = wps[#wps].Position
if old == nil then
for i,v in pairs(old) do v:Destroy() end
old = wps
elseif old ~= nil then
old = wps
end