Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

PathFinding Service failing when mapping out a path on higher ground?

Asked by 5 years ago
Edited 5 years ago

This script works perfectly, except when asked to climb up a ladder, it produces the error "Path Status: Failed." any ideas why?

Video


--These are to disable player's controls-- local ContextActionService = game:GetService("ContextActionService") local FREEZE_ACTION = "freezeMovement" --general defining local enabled = true local tool = script.Parent local player = game.Players.LocalPlayer local mouse = game.Players.LocalPlayer:GetMouse() function part(pos) if enabled ~= false then --checks if enabled is false. This prevents spamming --This destroys the previous visualPoint if game.Workspace:FindFirstChild("VisualPointFor"..player.Name) then game.Workspace:FindFirstChild("VisualPointFor"..player.Name):Destroy() end --This creates a visualPoint local visualPoint = Instance.new("Part",game.Workspace) visualPoint.Name = "VisualPointFor"..player.Name visualPoint.Size = Vector3.new(2,2,2) visualPoint.Shape = "Ball" visualPoint.Anchored = true visualPoint.BrickColor = BrickColor.new("Bright red") visualPoint.Position = game.Players.LocalPlayer:GetMouse().Hit.p visualPoint.CanCollide = false visualPoint.Material = Enum.Material.Neon visualPoint.Transparency = 0.4 visualPoint.BackSurface = Enum.SurfaceType.SmoothNoOutlines visualPoint.FrontSurface = Enum.SurfaceType.SmoothNoOutlines visualPoint.BottomSurface = Enum.SurfaceType.SmoothNoOutlines visualPoint.TopSurface = Enum.SurfaceType.SmoothNoOutlines visualPoint.LeftSurface = Enum.SurfaceType.SmoothNoOutlines visualPoint.RightSurface = Enum.SurfaceType.SmoothNoOutlines local me = player.Name local torso = game.Workspace:WaitForChild(me).Torso.Position local base = game.Players.LocalPlayer:GetMouse().Hit.p local human = game.Workspace:WaitForChild(me).Humanoid local path = game:GetService("PathfindingService"):FindPathAsync(torso,base) local points = path:GetWaypoints() if path.Status == Enum.PathStatus.Success then --disables controls enabled = false ContextActionService:BindAction( FREEZE_ACTION, function() return Enum.ContextActionResult.Sink end, false, unpack(Enum.PlayerActions:GetEnumItems()) ) for i,v in pairs(points) do human:MoveTo(v.Position) human.MoveToFinished:Wait() if v.Action == Enum.PathWaypointAction.Jump then human.Jump = true end end ContextActionService:UnbindAction(FREEZE_ACTION) --returns click access enabled = true else -- this is where it fails warn("Path Status: Failed.") end end end script.Parent.Equipped:connect(function() script.Parent.Activated:connect(function() part(mouse.Hit) end) end)
0
I'm unsure if the pathfinding can deal with ladders or a truss? If it cannot, attempt to just use :MoveTo() on the character to be past the ladder or truss and I believe they should climb alphawolvess 1784 — 5y
0
It should be possible... I'm trying to recreate Adv3rtize's pathfinding game and he somehow managed to do it TheGreenSuperman 85 — 5y

Answer this question