Thanks, but now the character doesn’t go around walls.
Do you know how I could fix this?
Here’s the code I have:
local path = game:GetService("PathfindingService"):CreatePath({AgentWidth = 2, AgentHeight = 5.75, AgentCanJump = false})
local success, errormsg = pcall(function()
path:ComputeAsync(script.Parent.HumanoidRootPart.Position, nearestPlayer.HumanoidRootPart.Position)
end)
if success then
local waypoints = path:GetWaypoints()
for _, i in waypoints do
if (waypoints[#waypoints].Position - nearestPlayer.HumanoidRootPart.Position).Magnitude > 5 or not nearestPlayer then
break
end
script.Parent.Humanoid:MoveTo(i.Position)
end
end
did you make sure the walls are collidable or has canquery enabled?
also, idk the internals of the pathfinding service, but try again with the walls visible