Pathfinding Service Producing insane Numbers

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    image
    As seen in the image above, pathfinding is producing insane numbers.

  2. What is the issue? Include screenshots / videos if possible!
    As a result, the model rams itself off the baseplate and into the void. The pathfinding produces insane numbers for the frst waypoint, but not the rest.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

Read multiple articles, couldnt find anything

image

I am trying to make a boss and i have a custom rig
(More below)

It is connected with motor6ds and anchors are turned off for everything apart from humanoidrootpart and bones.

Here is my code:

wait(5)
local Player
local PS = game:GetService("PathfindingService")
local Anim = script.ReaperSwim

while wait(5) do
	local LoadAnim = script.Parent.Humanoid:LoadAnimation(Anim):Play()
	local ClosestPlayer
	local LocalRootPart = script.Parent.HumanoidRootPart
	local Lowest = math.huge

	for i,v in pairs(game.Players:GetChildren()) do
		local magnitude = math.abs((v.Character.HumanoidRootPart.Position - LocalRootPart.Position).Magnitude)
		if magnitude < Lowest then
			Lowest = magnitude
			Player = v
		end
    end	
	
	local Path = PS:CreatePath()
	local Waypoints = Path:GetWaypoints()
	local success, errorMessage = pcall(function()
		Path:ComputeAsync(LocalRootPart.Position, Player.Character.HumanoidRootPart.Position)
	end)
	
	if success and Path.Status == Enum.PathStatus.Success then	
		Waypoints = Path:GetWaypoints()
	else
		print("Path Failed")
	end
	
	for i,v in pairs(Waypoints) do
		local Pos = v.Position 
		print(Waypoints)
        
		script.Parent.Humanoid:MoveTo(Pos)
		print(Pos)
		script.Parent.Humanoid.MoveToFinished:Wait()
	end
	
	
    print(Player)

end

If you need anything leave a comment,
Coconut

So if I round that vector3 in the screenshot it would be (0, 0, 0) (scientific notation). Where is your model situated?

1 Like

at the end of the giant decimal it says e-07, thats what produces massive the number

Its actually a β€œ-β€œ instead of a β€œ+”. Basically in scientific notation thats a really small decimal. Too see a full number in regular notation use β€˜string.format(%f”, longnumber)’

1 Like