I am trying to make an NPC walk to a part via pathfinding. when I try to run the script the output states the following: 'Unable to cast Instance to Vector3'
This is my code:
local PathfindingService = game:GetService("PathfindingService")
local human = script.Parent:WaitForChild("Humanoid")
local torso = script.Parent:WaitForChild("Torso")
local path = PathfindingService:CreatePath()
path:ComputeAsync(torso, game.Workspace.endpart.Position)
local waypoints = path:GetWaypoints()
for i, waypoint in pairs(waypoints) do
if waypoint.Action == Enum.PathWaypointAction.Jump then
human:ChangeState(Enum.HumanoidStateType.Jumping)
end
human:MoveTo(waypoint.Posistion)
human.MoveToFinished:Wait(2)
end
human.MoveTo(game.Workspace.endpart.Position)
Does anybody know why this is not working and how to solve this? Thanks in advance.

2 comments
On line 7, the first argument is the torso, an Instance, while it takes a Vector3.
eenheurn, your code looks way too similar to TheDevKing's tutorial on PathFinding. Please make sure you follow exactly what the person is telling you to do.