WaypointAction.Jump not triggering

I have a pathfinding script in which the humanoid is smaller than the usual character. For some reason, there is no jump waypoint action. Only walk is triggered?

robloxapp-20240214-2005389.wmv (1.7 MB)

local PathfindingService = game:GetService("PathfindingService")

local Pets = require(game.ServerScriptService.Pets)  --ignore; OOP
local PetStats = Pets.new(25,0.5,10) --ignore; OOP

local Pet = script.Parent
local Humanoid = Pet:WaitForChild("Humanoid")
local HumanoidRootPart = Pet.HumanoidRootPart

local AgentParams = {
	AgentHeight = 0.5,
	AgentCollisionGroupName = "Pets",
	AgentCanJump = true
}

local Path = PathfindingService:CreatePath()
local Goal

local GoToFood = coroutine.create(function()
		while true do
			local FoodsAvailable = workspace.FoodsAvailable:GetChildren()
			Goal = FoodsAvailable[math.random(1,#FoodsAvailable)]
			coroutine.yield()
		end
	end)

coroutine.resume(GoToFood)

local function WalkTo()
	Path:ComputeAsync(HumanoidRootPart.Position, Goal.Position)
	
	if Path.Status == Enum.PathStatus.Success then
		local Waypoints = Path:GetWaypoints()
		
		for i,Waypoint in pairs(Waypoints) do
			if Goal == nil then
				Path:Destroy()
			end
			
			--
Pet.PrimaryPart.CFrame = CFrame.lookAt(Pet.PrimaryPart.Position, Goal.Position)
			
			if Waypoint.Action == Enum.PathWaypointAction.Jump then
				Humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
			end
			
			print(Waypoint.Action)
			
			if Goal then
				Humanoid:MoveTo(Goal.Position)
				Humanoid.MoveToFinished:Wait()
				local Parts = workspace:GetPartsInPart(Pet.Region)
				print(Parts)
				
				coroutine.resume(GoToFood)
				break
			else
				Humanoid:MoveTo(Waypoint.Position)
				Humanoid.MoveToFinished:Wait()
			end
		end
	end
end

while true do

	WalkTo()
	wait()
end
1 Like

image

Whats the script about?(text text)

The script is meant for a pet in which it picks up food accordingly. There’s a region for the goal waypoint in which food is picked up inside said region. The problem is that the pet doesn’t jump when it is stuck.

What if you make it teleport back a bit to get it unstuck Making it so you dont have to Use

WaypointAction.jump

I think that’s a possible solution. I tried dragging it back from the wall and it started to jump? Although theres no action for jumping in terms of the waypoint actions and it doesn’t seem to work if I used the move tool instead. How would I accomplish what you propose?

Well what i would do is keep looking at the script for problems If that happens again try and freeze it somehow, Sorry i dont really know how to code i am just using what i know that could help

1 Like

After some checking, I realise that only blocked and jump waypoints do not work, but jumping in itself is possible so there’s something wrong with my AI’s character (being only one basepart aka the HumanoidRootPart) along with a tray above, or there’s some hidden property that wasn’t mentioned in the documentation.

AgentRadius, AgentHeight did not help at all. I also tried the SimplePath module but ended up with the same issue of not being able to track a blocked path or the need to jump. Ray cast would not be possible as well since the spawns would be random.

Refer to this and rectify your error

It doesn’t work. I’ve already put this as well. Both end up with the same issue of the NPC not jumping.

I’ve found a solution but unfortunately I’m not able to make the character jump. If you’re reading this and facing the same issue as me, what you can do is to adjust the hipheight of the character and change the height (Y) of the humanoidrootpart accordingly. This will not fix your issue of not being able to jump, but would be able to walk across smaller parts.

Using the humanoidroot part but itself is not practical.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.