I made a simple AI for testing purposes and it works fine, the dummy DOES get to the player but for some reason when the player moves from side to side while walking, the bot does it too but its sharp, how can I make it so that the bot doesn’t take sharp corners? Here’s the code:
local path
local waypoint
local oldpoints
local isWandering = 0
while task.wait() do
local enemytorso = GetTorso(hroot.Position)
if enemytorso ~= nil then -- if player detected
isWandering = 1
path = pfs:CreatePath()
path:ComputeAsync(hroot.Position, enemytorso.Position)
waypoint = path:GetWaypoints()
local rootr = Ray.new(hroot.Position, enemytorso.Position)
local phit, ppos = game.Workspace:FindPartOnRay(rootr, hroot)
for _, v in pairs(waypoint) do
human:MoveTo(enemytorso.Position)
human.MoveToFinished:Wait()
if PathWaypoint.Action == Enum.PathWaypointAction.Jump then
human.Jump = true
end
end
elseif enemytorso == nil then -- if player not detected
isWandering = 0
path = nil
waypoint = nil
human.MoveToFinished:Wait()
end
end
Thanks for any help!