function _G.MoveTo(model: Model, endCFrame: CFrame)
local humanoid = model:FindFirstChildOfClass("Humanoid")
if not humanoid then
warn(`Humanoid in {model} not found!`)
model:PivotTo(endCFrame)
return
end
local pp = model.PrimaryPart
if not pp then
warn(`PrimaryPart in {model} not found!`)
model:PivotTo(endCFrame)
return
end
local path = PathFindingService:CreatePath({
AgentRadius = pp.Size.X,
AgentCanJump = false,
Costs = {
no = math.huge,
}
})
local succes, error = pcall(path.ComputeAsync, path, pp.Position, endCFrame.Position)
if not succes then
for i = 0, 5, 1 do
warn(`Pathfinding computeAsync ({i}/5) faield! Error message:\n{error}`)
succes, error = pcall(path.ComputeAsync, path, pp.Position, endCFrame.Position)
if succes then
break
end
end
end
if _G.Data.debug then
for _, waypoint :PathWaypoint in pairs(path:GetWaypoints()) do
local part = Instance.new("Part")
part.Shape = Enum.PartType.Ball
part.Material = Enum.Material.Neon
part.Anchored = true
part.CanCollide = false
part:PivotTo(CFrame.new(waypoint.Position))
part.Parent = _G.Ram.temp
end
end
for _, waypoint :PathWaypoint in pairs(path:GetWaypoints()) do
humanoid:MoveTo(waypoint.Position)
humanoid.MoveToFinished:Wait()
end
end
I moved part, resized it, several times. Nothing changed.
Expected behavior
That path will not run through this part.
A private message is associated with this bug report