Do you know any way to make my npc stop spamming jump?, When i get close to him, he stops, but when i am far away, he starts spamming jump, i noticed this doesn’t happens when i delete the function on “onTrapped” that where it’s telling him to jump, but if i delete it , i won’t have a way to make him jump thru obstacles,and also it kinda takes long to jump, which is what i don’t want , otherwise it’s actually kinda better than SimplePath, these are the only bugs i’ve found
my current code goes like this :
local pathfindPosition = Vector3.new()
local path = Pathfinding.Humanoid(rake,
{
AgentHeight = 4, -- 3
AgentRadius = 2, -- 2
AgentCanJump = true,
AgentCanClimb = true,
Costs = {
PathfindAvoid = 9999,
Truss = 1,
},
PathSettings = {
SupportPartialPath = true,
},
WaypointSpacing = 5.5 -- 10
}
)
path.Reached:Connect(function(Waypoint, IsPartial)
task.wait(.1)
path:Run(pathfindPosition)
end)
path.WaypointReached:Connect(function(Waypoint, NextWaypoint)
task.wait(0.1)
path:Run(pathfindPosition)
end)
path.Error:Connect(function(ErrorType : string)
warn(ErrorType)
task.wait(0.1)
path:Run(pathfindPosition)
end)
path.Trapped:Connect(function(TrapType : string)
if rake.Monster:GetState() ~= Enum.HumanoidStateType.Climbing then
path.Jump()
end
path:Run(pathfindPosition)
end)
path.Timeout = true
path.Speed = 16
path.Visualize = true
path.Precise = true
I Do path:Run() in a loop