So I recently learned how to use pathfinding service! anyway the problem Is where the NPC Isn't following the player
script:
local NPC = script.Parent
local PathfindingService = game:GetService('PathfindingService')
local Players = game:GetService('Players')
local Player = Players:GetPlayerFromCharacter()
local path = PathfindingService:CreatePath()
path:ComputeAsync(NPC.Torso.Position, Player.Character.PrimaryPart.Position)
if path.Status == Enum.PathStatus.Success then
local Positions = path:GetWaypoints()
for i,v in pairs(Positions) do
local ball = Instance.new("Part", workspace)
ball.Position = v.Position
ball.Anchored = true
ball.CanCollide = false
ball.Size = Vector3.new(4,4,4)
ball.Transparency = 0.5
NPC.Humanoid:MoveTo(v.Position)
end
end

1 comment
Still doesn't work!