I recently made a robot custom character, and I have it paired with a pathfinding script. My issue is that when I try to tell the robot it is able to jump, or even try manually having it jump in the Humanoid properties menu, it doesn’t jump. Not even slightly going up or no animation, just doesn’t go up.
Strange, it jumps just fine for me. Possibly some code within the pathfinding scripts is keeping it from jumping, seeing as the model you posted doesn’t contain any of that code.
Interesting, I just tried it out myself again after a restart of Studio and it works.
I now have a new issue; pathfinding is not having the character jump. I am using a resource I found on the docs for pathfinding.
local character = game.Workspace.Robot
local humanoid = character.Humanoid
local path = PathfindingService:CreatePath({
AgentRadius = 2,
AgentHeight = character:GetExtentsSize().Y,
AgentCanJump = true,
Costs = {
Water = 20
}
})
local waypoints
local nextWaypointIndex
local blockedConnection
local reachedConnection
local success
local errorMessage
local function followPath()
success, errorMessage = pcall(function()
path:ComputeAsync(character.PrimaryPart.Position, destination)
end)
if success and path.Status == Enum.PathStatus.Success then
-- Get the path waypoints
waypoints = path:GetWaypoints()
-- Detect if path becomes blocked
blockedConnection = path.Blocked:Connect(function(blockedWaypointIndex)
-- Check if the obstacle is further down the path
if blockedWaypointIndex >= nextWaypointIndex then
-- Stop detecting path blockage until path is re-computed
blockedConnection:Disconnect()
-- Call function to re-compute new path
followPath(destination)
end
end)
-- Detect when movement to next waypoint is complete
if not reachedConnection then
reachedConnection = humanoid.MoveToFinished:Connect(function(reached)
if reached and nextWaypointIndex < #waypoints and newMoveIndex == moveIndex then
-- Increase waypoint index and move to next waypoint
nextWaypointIndex += 1
humanoid:MoveTo(waypoints[nextWaypointIndex].Position)
else
reachedConnection:Disconnect()
blockedConnection:Disconnect()
end
end)
end
-- Initially move to second waypoint (first waypoint is path start; skip it)
nextWaypointIndex = 2
humanoid:MoveTo(waypoints[nextWaypointIndex].Position)
else
warn("Path not computed!", errorMessage)
success = false
end
end
followPath()
You need to check if the 3rd action is a jump. Since you’re doing a while true as a trigger. The Number will keep getting replaced once they reach the 2nd point. So after the number changed into 2 you need to check if the 3rd waypoint is a jump action. If it is you must force the index into 3 instead of the normal 2.
For example
if waypoint[3] and waypoint[3].Action == Enum.PathWaypointAction.Jump then
nextWaypointIndex = 3
end
2nd Edit. You need to do While true in order to check it, you need to keep updating the pathfind to reach that location. Once you reach the location you can either disable that script or destroy it
The 2nd path waypoint (default) will ALWAYS be in the Action: Walk. Not saying making 3 the default is the best. You can still use 2, all you need to do to make sure your Pathfinder jump is to check the index 3 if it is jumping or not