Can I use Pathfinding on a actual Player Character?
local function ForcePlayerWalk(Player, Position)
local Path = PathfindingService:CreatePath({AgentRadius = 2, AgentHeight = 5, AgentCanJump = false})
Path:ComputeAsync(Player.Character.HumanoidRootPart.Position, Position)
local Waypoints = Path:GetWaypoints()
for _, Waypoint in pairs(Waypoints) do
Player.Character.Humanoid:MoveTo(Waypoint.Position)
Player.Character.Humanoid.MoveToFinished:Wait()
end
end
You should be able to just fine. EDIT: If the player moves it’ll override the :MoveTo() function. This website seems to solve that problem pretty well though.
Is the Position argument that parts position? If so, its because the rest of the block is in the way. Make the block non-collideable. (Although I’m not sure if pathfinding ignores non collide parts. )
Try making the block non-collidable regardless and tell me if that works.
Also, it may not work because if you’re using CFrame.new(0, part.Size.Y/2, 0), that’ll get the top surface of the block, to get the side you’re going to want to modify that so it’s creating a CFrame with an offset that’s not along the Y-axis of the part.
For example: CFrame.new(0, 0, -part.Size.Z/2)
This works because :MoveTo isn’t calculating to see if the move is possible or not. It’s just gonna start moving towards a position regardless of any other potential variables.
local PartFace = {
North = Part.CFrame:PointToWorldSpace(Vector3.new(0, 0, Part.Size.Z/2)),
South = Part.CFrame:PointToWorldSpace(Vector3.new(0, 0, (Part.Size.Z/2)*-1)),
West = Part.CFrame:PointToWorldSpace(Vector3.new(Part.Size.X/2, 0, 0)),
East = Part.CFrame:PointToWorldSpace(Vector3.new((Part.Size.X/2*-1), 0, 0))
}
I appreciate your help, I have actually forgoed the whole pathfinding thing, with the code I was using you could visually see the user stop and go, which I do not want.