I was trying to figure out pathfinding, and it was going pretty well until I ran into the error "Unable to cast Instance to Vector3." I tried looking up other solutions, but what they tried to achieve differed from what I'm attempting to, so the solutions weren't applicable. Here's the script:
while true do
path = game:GetService("PathfindingService"):ComputeRawPathAsync(script.Parent.PointA, script.Parent.PointB, 200)
points = path:GetPointCoordinates()
script.Parent.Points:ClearAllChildren()
for p = 1, #points do
part = Instance.new("Part")
part.FormFactor = Enum.FormFactor.Symmetric
part.CanCollide = false
part.Size = Vector3.new(1, 1, 1)
part.Position = points[p]
part.Anchored = true
part.Transparency = 1
part.Parent = script.Parent.Points
end
wait(.1)
end
The error was in the second line. I'm new to this, so if I did anything wrong, please tell me. Thank you!

1 comment
What is PointA and PointB