I was trying to make a pathing script when it just didn't move. There are no errors.
local PathFindigService = game:GetService("PathfindingService") local human = script.Parent:WaitForChild("Humanoid") local torso = script.Parent:WaitForChild("Torso") local path = PathFindigService:CreatePath() path:ComputeAsync(torso.position, game.Workspace.Part.Position) local waypoints = path:GetWaypoints() for i, waypoint in pairs(waypoints) do human:MoveTo(waypoint.Position) human.MoveToFinished:Wait(2) end
I agree with what @cmgtotalyawesome said. R15 models have a "LowerTorso" and an "UpperTorso" while R6 models just have "Torso" so that is probably messing up your code. Every r6 and r15 have a HumanoidRootPart though. But the main problem I see here is, you say
human.MoveToFinished:Wait(2)
That number 2 is unnecessary, and it is messing up the code. I think you meant to say
human.MoveToFinished:Wait() wait(2)
which waits until the move has finished, then waits 2 more seconds. Or you just want
human.MoveToFinished:Wait()
which just waits until the move has finished to continue the loop.
If that doesn't work then make sure that the NPC or model you are moving is not anchored (none of the limbs should be anchored)
hope this helps
Your using a torso to move, But the torso doesn't make you move, This is something in R6, R15, and rthro called a HumanoidRootPart it's basically a way to show Roblox where you are and it can move you so try this script.
local PathFindigService = game:GetService("PathfindingService") local human = script.Parent:WaitForChild("Humanoid") local rootPart = script.Parent:WaitForChild("HumanoidRootPart") local path = PathFindigService:CreatePath() path:ComputeAsync(rootPart.position, game.Workspace.Part.Position) local waypoints = path:GetWaypoints() for i, waypoint in pairs(waypoints) do human:MoveTo(waypoint.Position) human.MoveToFinished:Wait(2) end
game.Players.PlayerAdded:Connect(function(plr) plr.CharacterAdded:Connect(function(chr) local torso = chr:WaitForChild("Torso") local human = chr:WaitForChild("Humanoid") local pfs = game:GetService("PathfindingService") local ctorso = script.Parent:WaitForChild("Torso") local chuman = script.Parent:WaitForChild("Humanoid") local path = pfs:CreatePath() path:ComputeAsync(ctorso.Position, torso.Position) while true do chuman:MoveTo(torso.Position) wait(0.000001) end end) end)