My NPC is to complete an "obby," to make it to the other side to reach a glowing, neon Part. However, the NPC falls from the first jump. This is because it didn't jump at all.

The way it should be going

...But the way it is going

Here's the script (it is parented to the NPC):

local dummy = script.Parent -- The NPC 
local humanoid = dummy.Humanoid

local service = game:GetService("PathfindingService")
local path = service:CreatePath()
path:ComputeAsync(dummy.PrimaryPart.Position, workspace.locate.Position)
local waypoints = path:GetWaypoints()

for _, waypoint in pairs(waypoints) do -- If you know what "for _," means, explain that to me as well. 
	local part = Instance.new("Part")
	part.Material = "Neon"
	part.Size = Vector3.new(.6, .6, .6)
	part.Anchored = true 
	part.CanCollide = false 
	part.Position = waypoint.Position
	part.Parent = workspace
	
	humanoid:MoveTo(waypoint.Position)
	humanoid.MoveToFinished:Wait()
end

I mentioned it in the script, but I don't understand what "for _," means. Would you happen to know what that means, too?

2 comments

0

Looks like xy problemmmmm you think knowing what "for _," means will solve your issue

0

pretty sure the _ is just a preference to have the index not be defined, so instead of "for Index,Object" it's just "for _,Object", correct me if I'm wrong.