Project
In short, I’m trying to recreate some AI that will follow the path when set.
Script
local function SetGuide(player)
print('tracking movements for '..player.Name)
local Place = player.Character.HumanoidRootPart.Position
--Takes the original place of the character
local Steps = {}
local function AddCO(Position,Jump)
--this small function will record the player's position relative to the starting pointit will also record whether or not the player has jumped
table.insert(Steps,{Place-Position,Jump})
end
player.Character.Humanoid:GetPropertyChangedSignal('Jump'):Connect(function()
--when the player jumps, the jump bool part of the table will be true, telling when to jump
AddCO(player.Character.HumanoidRootPart.Position,true)
end)
for i = 1,100 do
wait(.1)
AddCO(player.Character.HumanoidRootPart.Position,false)
if player.Character.Humanoid:GetState() == Enum.HumanoidStateType.None then
break
end
--Will constantly add the position into the table. Jumping will disregard the loop and add the jump bool anyway.
end
return Steps
end
--this function will execute the steps given to it by a table designed by the first function
local function FollowSteps(Steps,model)
if model then
if Steps then
--for testing purposes, I added in a part for where every step was.
local position = model.HumanoidRootPart.Position
for i,v in pairs(Steps) do
local Part = Instance.new("Part")
Part.BrickColor = BrickColor.new("Toothpaste")
Part.Material = 'Neon'
Part.Size = Vector3.new(.5,.5,.5)
Part.Position = position-v[1]
Part.Anchored = true
Part.CanCollide = false
Part.Parent = workspace
end
assert(type(Steps) == 'table','Table required for steps, got'..type(Steps))
--This part of the script will move the character to the next position.
for i, Data in ipairs(Steps) do
model.Humanoid:MoveTo(position-Data[1]
print(Data[2])
--this is supposed to print whether or not the jump bool was recorded true
if Data[2] then
model.Humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
end
model.Humanoid.MoveToFinished:Wait()
end
end
end
end
Problem
The follow function just wont jump. It ignores the jump bool in the table. Is there something I did wrong causing this to happen? There are no errors in the output.

Not sure if its very clear in the picture, but the follow function has checkpoints in the air as well as multiple signals telling the NPC to jump, but it just doesn’t.
I’ve visited the wiki on ChangeState as well as MoveTo(). Just to be sure I was doing everything correctly, I visited the PathFinding wiki 3 or 4 times. I would appreciate some guidance on this. Thanks!
This was my testing script, in case it’s important
local Steps = SetGuide(game.Players:WaitForChild('ancant64'))
wait(1)
print('Data transferred')
FollowSteps(Steps,game.Workspace.Player)