So , i have a IA script for my NPC , the script create a routine for the NPC , like when its 8 am do that ... The problem is that sometimes the NPC want to do 2 things at the same times and i dont know why .. So if u can help me with my script thx :)
Code:
local pathService = game:GetService("PathfindingService")
local finish = workspace.ici
function followPath(path)
local points = path:GetWayPoints()
for index, point in pairs(points) do
if point.Action == Enum.PathWaypointAction.Walk then
script.Parent.Humanoid:MoveTo(point.Position)
script.Parent.Humanoid.MoveToFinished:Wait()
end
if point.Action == Enum.PathWaypointAction.Jump then
script.Parent.Humanoid.Jump = true
end
end
end
while wait() do
local getPath = pathService:ComputeRawPathAsync(script.Parent.HumanoidRootPart.Position, finish.Position, 500)
followPath(getPath)
end

1 comment
while loops = lag