Im using pathfinding for my ai animals but the problem is that the animation for walking is not smoooth and is basically hiccupy and then sometimes the idle animation just stop entirely
local function wander()
-- randomStuff
local randX = math.random(-15,15)
local randZ = math.random(-15,15)
local goal = humanoidRootPart.Position + Vector3.new(randX,0,randZ)
-- Services
local path = game:GetService("PathfindingService"):CreatePath()
path:ComputeAsync(humanoidRootPart.Position, goal)
local points = path:GetWaypoints()
if path.Status == Enum.PathStatus.Success then
for _, point in pairs(points) do
if point.Action == Enum.PathWaypointAction.Jump then
humanoid.Jump = true
end
humanoid:MoveTo(point.Position)
humanoid.MoveToFinished:Wait()
end
else
print("Path failed")
end
end
while wait(math.random(2,5)) do
wander()
end
I think this is because it’s something to do with SetNetworkOwnership. Because in Roblox, clients or servers can calculate a part’s physics but only one of them can take the priority. So if you go too near the NPC, the NPC’s network ownership would be confuse because it would switch to client and then to the server and then vice versa. So, to solve this just set the model’s primary part’s network owner to the server.
Wait actually your wrong I am waiting until they can move again because Im using the MoveToFinished function, make sure you read carefully before replying