I have a working pathfinding script that moves an NPC from point A to point B (Vector3.new(x,y,z)). However, the script only works, as in the path only computes when the destination is a vector 3 position. The problem is that I want to be able to use a part’s position as the destination, and this breaks the script. The reason for this is that I want to store more information at each destination, such as int values as children of each part that list the next possible destinations. If anyone knows a better way to store this information/fix the position problem, that would be greatly appreciated.
After some debugging, I have found that this solution works:
local pos = game.Workspace.endPoint.CFrame.Position
local TEST_DESTINATION = Vector3.new(pos.X, 0, pos.Z)
Using the X and Z values of the part, I am able to get the part’s position, but only if I leave one of the values as an integer (in this case Y) in a vector3 instance. It does not work with Vector3.new(pos.X, pos.Y, pos.Z). I find this kid of odd but it probably points to the issue here.