You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
As seen in the image above, pathfinding is producing insane numbers. -
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. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Read multiple articles, couldnt find anything
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