I am trying to make a monster that randomly walks around a randomly generated maze, using lots of little nodes around the place, as the maze is grid based, so all of these are possible to get to. The walls are 2 studs thick, but for some reason the monster is trying to walk through them.

Here, it is trying to get to a waypoint that is somewhere on the right, and the monster is attempting to go through the wall to get to it. It can still pathfind around walls and corners, but for some reason every so often would prefer to do this.
The script: (A server script inside the monster’s model
wait(5) --Allows the maze time to generate
local monster = script.Parent
local humanoid = monster.Humanoid
local PathfindingService = game:GetService("PathfindingService")
local function getPath(destination)
local pathParamaters = { --Parameters for not getting stuck on walls etc
["AgentHeight"] = 12.75,
["AgentRadius"] = 3,
["AgentCanJump"] = false
}
local path = PathfindingService:CreatePath(pathParamaters)
path:ComputeAsync(monster.HumanoidRootPart.Position, destination.Position)
return path
end
local function walkTo(destination)
local path = getPath(destination)
for index, waypoint in pairs(path:GetWaypoints()) do
humanoid:MoveTo(waypoint.Position)
humanoid.MoveToFinished:Wait()
end
end
local function patrol()
local waypoints = game.Workspace.Collectibles.Spawns:GetChildren() --The waypoints
local randomNum = math.random(1, #waypoints)
walkTo(waypoints[randomNum])
end
while wait() do
patrol()
end
Does anyone know how i can stop this issue from occuring?