I have made a small 2 lava jump obby test course for an npc that I put together with a pathfinding script I made. Problem is that it despite setting neon as one of the costs in the createpath table (which is the material used for the jumps), it seems that it fails at every attempt to get to the set goal position whether it’s by jumping too early, not at all or just straight up going off the course path entirely (they can’t get back onto it afterwards) and falling off. I’ve tried resizing the parts to just one stud wide instead of the two I began with and even substituted the math.huge value for the cost of the neon material in the script for 10 and it continues to do this.
For reference:
local pathservice = game:GetService("PathfindingService")
local humanoid = script.Parent.Humanoid
local body = script.Parent:FindFirstChild("HumanoidRootPart") or script.Parent:FindFirstChild("Torso")
local destination = workspace.PathMap.Goal.Position
local path = pathservice:CreatePath({
AgentRadius = 4, -- comma seperation in table
AgentHeight = 5.5,
Costs = {
Neon = 10
}
})
path:ComputeAsync(body.Position, destination)
local waypoints = path:GetWaypoints()
-- iterate through waypoints and jump when needed
for i, waypoint in pairs(waypoints) do
humanoid:MoveTo(waypoint.Position)
if waypoint.Action == Enum.PathWaypointAction.Jump then
humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
end
humanoid.MoveToFinished:Wait()
end
I just need the NPC to jump over the lava parts (red neon parts in snippet) without dying so that it can reach the goal at the end. How can I fix this?